Bug #5615 | type of aggregate function column wrong when using group by | ||
---|---|---|---|
Submitted: | 16 Sep 2004 19:37 | Modified: | 2 Mar 2005 21:18 |
Reporter: | Jim Nusbaum | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server | Severity: | S1 (Critical) |
Version: | 4.1.3 | OS: | Any (any) |
Assigned to: | Ramil Kalimullin | CPU Architecture: | Any |
[16 Sep 2004 19:37]
Jim Nusbaum
[16 Sep 2004 19:39]
Jim Nusbaum
I have verified that the same bug occurs for all table types and in 4.1.4.
[6 Oct 2004 10:58]
Hartmut Holzgraefe
the following PHP script was used to reproduce the problem: <?php mysql_connect("localhost", "root", "") or die(mysql_error()); mysql_select_db("test") or die(mysql_error()); mysql_query("CREATE TEMPORARY TABLE test (product VARCHAR(32), stamp DATETIME)"); for ($i = 0; $i < 100; $i++) { $t = chr(65 + $i % 5); mysql_query("INSERT INTO test(product, stamp) VALUES('$t', '2004-09-15 13:45:05')"); } $res = mysql_query("SELECT MAX(stamp) FROM test"); echo mysql_field_type($res, 0) . "\n"; $res = mysql_query("SELECT MAX(stamp) FROM test GROUP BY product"); echo mysql_field_type($res, 0) . "\n"; ?>
[11 Oct 2004 13:03]
Ramil Kalimullin
An easier way to check it is something like: drop table if exists t1, t2; create table t1(a int, b datetime); insert into t1 values (1, NOW()), (2, NOW()); create table t2 select MAX(b) from t1 order by a; show create table t2;
[11 Oct 2004 13:17]
Ramil Kalimullin
Sorry, create table t2 select MAX(b) from t1 order by a; ---> create table t2 select MAX(b) from t1 group by a;
[1 Mar 2005 10:17]
Ramil Kalimullin
fixed in 4.1.11
[2 Mar 2005 21:18]
Paul DuBois
Noted in 4.1.11 changelog.