diff options
author | Davi Arnaut <Davi.Arnaut@Sun.COM> | 2008-10-24 10:50:59 -0200 |
---|---|---|
committer | Davi Arnaut <Davi.Arnaut@Sun.COM> | 2008-10-24 10:50:59 -0200 |
commit | 1585368047027e66e6823f9c20d0d8610ae42487 (patch) | |
tree | f22f6d527d9486dd9fee61ed406841efe147658b | |
parent | 2bf160b05ede24b766a8db1a93df3891ab9b45f6 (diff) | |
parent | 5fd9914910d5c3e3bc30a74245af56749c47f727 (diff) | |
download | mariadb-git-1585368047027e66e6823f9c20d0d8610ae42487.tar.gz |
Merge from mysql-5.0-bugteam into mysql-5.1-bugteam
-rw-r--r-- | mysql-test/r/group_by.result | 30 | ||||
-rw-r--r-- | mysql-test/r/partition_not_windows.result | 4 | ||||
-rw-r--r-- | mysql-test/r/partition_symlink.result | 4 | ||||
-rw-r--r-- | mysql-test/r/symlink.result | 10 | ||||
-rw-r--r-- | mysql-test/t/group_by.test | 29 | ||||
-rw-r--r-- | sql/sql_select.h | 2 | ||||
-rw-r--r-- | zlib/gzio.c | 5 |
7 files changed, 74 insertions, 10 deletions
diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result index 30c4d1e4ca1..12e1460e128 100644 --- a/mysql-test/r/group_by.result +++ b/mysql-test/r/group_by.result @@ -1274,6 +1274,36 @@ tt 41 SET sql_mode=@save_sql_mode; DROP TABLE t1, t2; +# +# BUG#38072: Wrong result: HAVING not observed in a query with aggregate +# +CREATE TABLE t1 ( +pk int(11) NOT NULL AUTO_INCREMENT, +int_nokey int(11) NOT NULL, +int_key int(11) NOT NULL, +varchar_key varchar(1) NOT NULL, +varchar_nokey varchar(1) NOT NULL, +PRIMARY KEY (pk), +KEY int_key (int_key), +KEY varchar_key (varchar_key) +); +INSERT INTO t1 VALUES +(1,5,5, 'h','h'), +(2,1,1, '{','{'), +(3,1,1, 'z','z'), +(4,8,8, 'x','x'), +(5,7,7, 'o','o'), +(6,3,3, 'p','p'), +(7,9,9, 'c','c'), +(8,0,0, 'k','k'), +(9,6,6, 't','t'), +(10,0,0,'c','c'); +explain SELECT COUNT(varchar_key) AS X FROM t1 WHERE pk = 8 having 'foo'='bar'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible HAVING +SELECT COUNT(varchar_key) AS X FROM t1 WHERE pk = 8 having 'foo'='bar'; +X +drop table t1; End of 5.0 tests CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a), diff --git a/mysql-test/r/partition_not_windows.result b/mysql-test/r/partition_not_windows.result index c0247babb50..cf1fec98b07 100644 --- a/mysql-test/r/partition_not_windows.result +++ b/mysql-test/r/partition_not_windows.result @@ -24,8 +24,8 @@ data directory='/not/existing' index directory='/not/existing' ); Warnings: -Warning 1616 <DATA DIRECTORY> option ignored -Warning 1616 <INDEX DIRECTORY> option ignored +Warning 1618 <DATA DIRECTORY> option ignored +Warning 1618 <INDEX DIRECTORY> option ignored show create table t2; Table Create Table t2 CREATE TABLE `t2` ( diff --git a/mysql-test/r/partition_symlink.result b/mysql-test/r/partition_symlink.result index 00c9f5b3f01..894966f6c53 100644 --- a/mysql-test/r/partition_symlink.result +++ b/mysql-test/r/partition_symlink.result @@ -101,8 +101,8 @@ data directory='/not/existing' index directory='/not/existing' ); Warnings: -Warning 1616 <DATA DIRECTORY> option ignored -Warning 1616 <INDEX DIRECTORY> option ignored +Warning 1618 <DATA DIRECTORY> option ignored +Warning 1618 <INDEX DIRECTORY> option ignored show create table t2; Table Create Table t2 CREATE TABLE `t2` ( diff --git a/mysql-test/r/symlink.result b/mysql-test/r/symlink.result index df4aa343f1f..7711517fe5e 100644 --- a/mysql-test/r/symlink.result +++ b/mysql-test/r/symlink.result @@ -79,7 +79,7 @@ drop database mysqltest; create table t1 (a int not null) engine=myisam; alter table t1 data directory="MYSQLTEST_VARDIR/tmp"; Warnings: -Warning 1616 <DATA DIRECTORY> option ignored +Warning 1618 <DATA DIRECTORY> option ignored show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -88,7 +88,7 @@ t1 CREATE TABLE `t1` ( alter table t1 add b int; alter table t1 data directory="MYSQLTEST_VARDIR/log"; Warnings: -Warning 1616 <DATA DIRECTORY> option ignored +Warning 1618 <DATA DIRECTORY> option ignored show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -97,7 +97,7 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 alter table t1 index directory="MYSQLTEST_VARDIR/log"; Warnings: -Warning 1616 <INDEX DIRECTORY> option ignored +Warning 1618 <INDEX DIRECTORY> option ignored show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -164,8 +164,8 @@ ERROR HY000: Can't create/write to file 'TEST_DIR/master-data_var/t1.MYI' (Errco SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE='NO_DIR_IN_CREATE'; CREATE TABLE t1(a INT) DATA DIRECTORY='MYSQLTEST_VARDIR/tmp' INDEX DIRECTORY='MYSQLTEST_VARDIR/tmp'; Warnings: -Warning 1616 <DATA DIRECTORY> option ignored -Warning 1616 <INDEX DIRECTORY> option ignored +Warning 1618 <DATA DIRECTORY> option ignored +Warning 1618 <INDEX DIRECTORY> option ignored DROP TABLE t1; SET @@SQL_MODE=@OLD_SQL_MODE; End of 5.1 tests diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test index d02e8e10a2b..36aef981f21 100644 --- a/mysql-test/t/group_by.test +++ b/mysql-test/t/group_by.test @@ -940,6 +940,35 @@ select (select sum(outr.a + t1.a) from t1 limit 1) as tt from t1 as outr order b SET sql_mode=@save_sql_mode; DROP TABLE t1, t2; +--echo # +--echo # BUG#38072: Wrong result: HAVING not observed in a query with aggregate +--echo # +CREATE TABLE t1 ( + pk int(11) NOT NULL AUTO_INCREMENT, + int_nokey int(11) NOT NULL, + int_key int(11) NOT NULL, + varchar_key varchar(1) NOT NULL, + varchar_nokey varchar(1) NOT NULL, + PRIMARY KEY (pk), + KEY int_key (int_key), + KEY varchar_key (varchar_key) +); +INSERT INTO t1 VALUES +(1,5,5, 'h','h'), +(2,1,1, '{','{'), +(3,1,1, 'z','z'), +(4,8,8, 'x','x'), +(5,7,7, 'o','o'), +(6,3,3, 'p','p'), +(7,9,9, 'c','c'), +(8,0,0, 'k','k'), +(9,6,6, 't','t'), +(10,0,0,'c','c'); + +explain SELECT COUNT(varchar_key) AS X FROM t1 WHERE pk = 8 having 'foo'='bar'; +SELECT COUNT(varchar_key) AS X FROM t1 WHERE pk = 8 having 'foo'='bar'; +drop table t1; + --echo End of 5.0 tests # Bug #21174: Index degrades sort performance and # optimizer does not honor IGNORE INDEX. diff --git a/sql/sql_select.h b/sql/sql_select.h index dbeace2ffa4..be159c523e0 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -514,7 +514,7 @@ public: bool send_row_on_empty_set() { return (do_send_rows && tmp_table_param.sum_func_count != 0 && - !group_list); + !group_list && having_value != Item::COND_FALSE); } bool change_result(select_result *result); bool is_top_level_join() const diff --git a/zlib/gzio.c b/zlib/gzio.c index 7e90f4928fc..ed4e77ca7e9 100644 --- a/zlib/gzio.c +++ b/zlib/gzio.c @@ -7,6 +7,11 @@ /* @(#) $Id$ */ +/* Need to be included "early" to control other headers */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + #include <stdio.h> #include "zutil.h" |