Bug #4323 | getObject typing breaks in group by with timestamp and date manipulation | ||
---|---|---|---|
Submitted: | 29 Jun 2004 13:16 | Modified: | 30 Jun 2004 22:54 |
Reporter: | Paolo Campanella | Email Updates: | |
Status: | Duplicate | Impact on me: | |
Category: | MySQL Server | Severity: | S2 (Serious) |
Version: | 3.0.14 and below | OS: | Linux (Linux) |
Assigned to: | CPU Architecture: | Any |
[29 Jun 2004 13:16]
Paolo Campanella
[29 Jun 2004 15:49]
Mark Matthews
This is not a Connector/J bug, but a server bug (it's changing the return type of the operands when a 'group by' is issued), so I'm changing the category.
[30 Jun 2004 17:38]
Paolo Campanella
Hi again Typing is also broken when GROUPing by on a SUMmed INT column (outputs a floating point number). I'm not adding this as a separate bug because I suspect that there are many related typing issues with various column types in aggregate functions. Ho to reproduce: try { Statement cstmt = con.createStatement(); cstmt.executeUpdate("create table intbug(x int, y int)"); cstmt.executeUpdate("insert into intbug values(1,1)"); cstmt.executeUpdate("insert into intbug values(1,1)"); ResultSet rs = cstmt.executeQuery("select x from intbug"); if (rs.next()) System.out.println("Class is " + rs.getObject("x").getClass()); cstmt = con.createStatement(); String query = "select sum(x) as x from intbug"; query += " group by y"; rs = cstmt.executeQuery(query); if (rs.next()) System.out.println("Class is " + rs.getObject("x").getClass()); cstmt.executeUpdate("drop table intbug"); } catch (Exception e) { e.printStackTrace(); } Output is: Class is class java.lang.Integer Class is class java.lang.Double
[30 Jun 2004 21:36]
Dean Ellis
Verified against 4.0.21. It is reporting FIELD_TYPE_STRING with the combination of DATE_ADD() and the GROUP BY.
[30 Jun 2004 22:54]
Sergei Golubchik
Please do not submit the same bug more than once. An existing bug report already describes this very problem. Even if you feel that your issue is somewhat different, the resolution is likely to be the same. Because of this, we hope you add your comments to the original bug instead. Thank you for your interest in MySQL. Additional info: see http://bugs.mysql.com/bug.php?id=4176