Loading Docs/manual.texi +2 −0 Original line number Diff line number Diff line Loading @@ -46839,6 +46839,8 @@ not yet 100% confident in this code. @appendixsubsec Changes in release 3.23.47 @itemize @bullet @item Fixed that @code{GROUP BY expr DESC} works. @item Fixed bug when using @code{t1 LEFT JOIN t2 ON t2.key=constant}. @item @code{mysqlconfig} now also work with binary (relocated) distributions. libmysql/libmysql.c +2 −0 Original line number Diff line number Diff line Loading @@ -1955,6 +1955,8 @@ mysql_fetch_row(MYSQL_RES *res) DBUG_PRINT("info",("end of data")); res->eof=1; res->handle->status=MYSQL_STATUS_READY; /* Don't clear handle in mysql_free_results */ res->handle=0; } } DBUG_RETURN((MYSQL_ROW) NULL); Loading mysql-test/r/group_by.result +30 −0 Original line number Diff line number Diff line Loading @@ -34,3 +34,33 @@ Test Procedures 0 2 a 0 1+1 a count(*) 2 a 0 table type possible_keys key key_len ref rows Extra t1 ALL NULL NULL NULL NULL 6 Using temporary userid count(*) 3 3 2 1 1 2 table type possible_keys key key_len ref rows Extra t1 range spID spID 5 NULL 2 where used; Using index; Using temporary table type possible_keys key key_len ref rows Extra t1 range spID spID 5 NULL 2 where used; Using index spid count(*) 1 1 2 2 spid count(*) 2 2 1 1 table type possible_keys key key_len ref rows Extra t1 ALL NULL NULL NULL NULL 6 Using filesort spid sum(userid) 5 3 4 3 3 3 2 3 1 1 table type possible_keys key key_len ref rows Extra t1 index NULL score 3 NULL 6 Using index score count(*) 3 3 2 1 1 2 mysql-test/t/group_by.test +24 −1 Original line number Diff line number Diff line Loading @@ -38,7 +38,6 @@ INSERT INTO t2 VALUES (3,'name','pass','mail','Y','v','n','adr','1','1','1'); SELECT t2.userid, MIN(t1.score) FROM t1, t2 WHERE t1.userID=t2.userID GROUP BY t2.userid; SELECT t2.userid, MIN(t1.score) FROM t1, t2 WHERE t1.userID=t2.userID AND t1.spID=2 GROUP BY t2.userid; SELECT t2.userid, MIN(t1.score+0.0) FROM t1, t2 WHERE t1.userID=t2.userID AND t1.spID=2 GROUP BY t2.userid; drop table test.t1,test.t2; # Loading Loading @@ -220,3 +219,27 @@ select 1+1, "a",count(*) from t1 where foo in (2); insert into t1 values (1); select 1+1,"a",count(*) from t1 where foo in (2); drop table t1; # # Test GROUP BY DESC CREATE TABLE t1 ( spID int(10) unsigned, userID int(10) unsigned, score smallint(5) unsigned, key (spid), key (score) ); INSERT INTO t1 VALUES (1,1,1),(2,2,2),(2,1,1),(3,3,3),(4,3,3),(5,3,3); explain select userid,count(*) from t1 group by userid desc; select userid,count(*) from t1 group by userid desc; explain select spid,count(*) from t1 where spid between 1 and 2 group by spid desc; explain select spid,count(*) from t1 where spid between 1 and 2 group by spid; select spid,count(*) from t1 where spid between 1 and 2 group by spid; select spid,count(*) from t1 where spid between 1 and 2 group by spid desc; explain select sql_big_result spid,sum(userid) from t1 group by spid desc; select sql_big_result spid,sum(userid) from t1 group by spid desc; explain select sql_big_result score,count(*) from t1 group by score desc; select sql_big_result score,count(*) from t1 group by score desc; drop table t1; sql/sql_lex.h +1 −1 Original line number Diff line number Diff line Loading @@ -140,7 +140,7 @@ typedef struct st_lex { enum lex_states next_state; enum enum_duplicates duplicates; enum enum_tx_isolation tx_isolation; uint in_sum_expr,grant,grant_tot_col,which_columns, sort_default; uint in_sum_expr,grant,grant_tot_col,which_columns; thr_lock_type lock_option; bool create_refs,drop_primary,drop_if_exists,local_file; bool in_comment,ignore_space,verbose; Loading Loading
Docs/manual.texi +2 −0 Original line number Diff line number Diff line Loading @@ -46839,6 +46839,8 @@ not yet 100% confident in this code. @appendixsubsec Changes in release 3.23.47 @itemize @bullet @item Fixed that @code{GROUP BY expr DESC} works. @item Fixed bug when using @code{t1 LEFT JOIN t2 ON t2.key=constant}. @item @code{mysqlconfig} now also work with binary (relocated) distributions.
libmysql/libmysql.c +2 −0 Original line number Diff line number Diff line Loading @@ -1955,6 +1955,8 @@ mysql_fetch_row(MYSQL_RES *res) DBUG_PRINT("info",("end of data")); res->eof=1; res->handle->status=MYSQL_STATUS_READY; /* Don't clear handle in mysql_free_results */ res->handle=0; } } DBUG_RETURN((MYSQL_ROW) NULL); Loading
mysql-test/r/group_by.result +30 −0 Original line number Diff line number Diff line Loading @@ -34,3 +34,33 @@ Test Procedures 0 2 a 0 1+1 a count(*) 2 a 0 table type possible_keys key key_len ref rows Extra t1 ALL NULL NULL NULL NULL 6 Using temporary userid count(*) 3 3 2 1 1 2 table type possible_keys key key_len ref rows Extra t1 range spID spID 5 NULL 2 where used; Using index; Using temporary table type possible_keys key key_len ref rows Extra t1 range spID spID 5 NULL 2 where used; Using index spid count(*) 1 1 2 2 spid count(*) 2 2 1 1 table type possible_keys key key_len ref rows Extra t1 ALL NULL NULL NULL NULL 6 Using filesort spid sum(userid) 5 3 4 3 3 3 2 3 1 1 table type possible_keys key key_len ref rows Extra t1 index NULL score 3 NULL 6 Using index score count(*) 3 3 2 1 1 2
mysql-test/t/group_by.test +24 −1 Original line number Diff line number Diff line Loading @@ -38,7 +38,6 @@ INSERT INTO t2 VALUES (3,'name','pass','mail','Y','v','n','adr','1','1','1'); SELECT t2.userid, MIN(t1.score) FROM t1, t2 WHERE t1.userID=t2.userID GROUP BY t2.userid; SELECT t2.userid, MIN(t1.score) FROM t1, t2 WHERE t1.userID=t2.userID AND t1.spID=2 GROUP BY t2.userid; SELECT t2.userid, MIN(t1.score+0.0) FROM t1, t2 WHERE t1.userID=t2.userID AND t1.spID=2 GROUP BY t2.userid; drop table test.t1,test.t2; # Loading Loading @@ -220,3 +219,27 @@ select 1+1, "a",count(*) from t1 where foo in (2); insert into t1 values (1); select 1+1,"a",count(*) from t1 where foo in (2); drop table t1; # # Test GROUP BY DESC CREATE TABLE t1 ( spID int(10) unsigned, userID int(10) unsigned, score smallint(5) unsigned, key (spid), key (score) ); INSERT INTO t1 VALUES (1,1,1),(2,2,2),(2,1,1),(3,3,3),(4,3,3),(5,3,3); explain select userid,count(*) from t1 group by userid desc; select userid,count(*) from t1 group by userid desc; explain select spid,count(*) from t1 where spid between 1 and 2 group by spid desc; explain select spid,count(*) from t1 where spid between 1 and 2 group by spid; select spid,count(*) from t1 where spid between 1 and 2 group by spid; select spid,count(*) from t1 where spid between 1 and 2 group by spid desc; explain select sql_big_result spid,sum(userid) from t1 group by spid desc; select sql_big_result spid,sum(userid) from t1 group by spid desc; explain select sql_big_result score,count(*) from t1 group by score desc; select sql_big_result score,count(*) from t1 group by score desc; drop table t1;
sql/sql_lex.h +1 −1 Original line number Diff line number Diff line Loading @@ -140,7 +140,7 @@ typedef struct st_lex { enum lex_states next_state; enum enum_duplicates duplicates; enum enum_tx_isolation tx_isolation; uint in_sum_expr,grant,grant_tot_col,which_columns, sort_default; uint in_sum_expr,grant,grant_tot_col,which_columns; thr_lock_type lock_option; bool create_refs,drop_primary,drop_if_exists,local_file; bool in_comment,ignore_space,verbose; Loading