From 783705fc65080e9f1bdc8659f0a792f61069abe0 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 26 Apr 2005 21:27:06 +0300 Subject: [PATCH 01/11] union.result: Results for the above test case union.test: A test case for bug #10032 involving UNION's and ORDER BY clause sql_yacc.yy: Fix for a bug #10032 involving a parser bug with UNION's and ORDER BY sql/sql_yacc.yy: Fix for a bug #10032 involving a parser bug with UNION's and ORDER BY mysql-test/t/union.test: A test case for bug #10032 involving UNION's and ORDER BY clause mysql-test/r/union.result: Results for the above test case --- mysql-test/r/union.result | 19 +++++++++++++++++++ mysql-test/t/union.test | 11 +++++++++++ sql/sql_yacc.yy | 2 +- 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result index c140ecd26e1..b315ae9a3f5 100644 --- a/mysql-test/r/union.result +++ b/mysql-test/r/union.result @@ -1235,3 +1235,22 @@ show columns from t2; Field Type Null Key Default Extra a varchar(3) YES NULL drop table t2, t1; +create table t1 ( id int not null auto_increment, primary key (id), col1 int); +insert into t1 (col1) values (2),(3),(4),(5),(6); +select 99 union all select id from t1 order by 1; +99 +1 +2 +3 +4 +5 +99 +select id from t1 union all select 99 order by 1; +id +1 +2 +3 +4 +5 +99 +drop table t1; diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test index b0446e1ea4a..ecd98428b5a 100644 --- a/mysql-test/t/union.test +++ b/mysql-test/t/union.test @@ -742,3 +742,14 @@ create table t2 select a from t1 union select c from t1; create table t2 select a from t1 union select b from t1; show columns from t2; drop table t2, t1; + + +# +# Bug #10032 Bug in parsing UNION with ORDER BY when one node does not use FROM +# + +create table t1 ( id int not null auto_increment, primary key (id), col1 int); +insert into t1 (col1) values (2),(3),(4),(5),(6); +select 99 union all select id from t1 order by 1; +select id from t1 union all select 99 order by 1; +drop table t1; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 594077dd4f3..8c9c845bbbd 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -2449,7 +2449,7 @@ select_part2: select_into select_lock_type; select_into: - opt_limit_clause {} + opt_order_clause opt_limit_clause {} | into | select_from | into select_from From ec00a4558c966d0f2b591a8acb365d69211607ef Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 20 May 2005 06:56:02 -0700 Subject: [PATCH 02/11] Additions for --add-drop-database client/client_priv.h: Adding option for drop database client/mysqldump.c: Work for adding of --add-drop-database mysql-test/r/mysqldump.result: New test results for --add-drop-databases mysql-test/t/mysqldump.test: Tests for --add-drop-databases --- client/client_priv.h | 2 +- client/mysqldump.c | 19 ++++++++++++++---- mysql-test/r/mysqldump.result | 38 +++++++++++++++++++++++++++++++++++ mysql-test/t/mysqldump.test | 9 +++++++++ 4 files changed, 63 insertions(+), 5 deletions(-) diff --git a/client/client_priv.h b/client/client_priv.h index 45806349d7d..5085c03e84f 100644 --- a/client/client_priv.h +++ b/client/client_priv.h @@ -49,5 +49,5 @@ enum options_client #ifdef HAVE_NDBCLUSTER_DB ,OPT_NDBCLUSTER,OPT_NDB_CONNECTSTRING #endif - ,OPT_IGNORE_TABLE,OPT_INSERT_IGNORE + ,OPT_IGNORE_TABLE,OPT_INSERT_IGNORE,OPT_DROP_DATABASE }; diff --git a/client/mysqldump.c b/client/mysqldump.c index 493ef57a73b..7b18b1d92da 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -85,7 +85,7 @@ static my_bool verbose=0,tFlag=0,dFlag=0,quick= 1, extended_insert= 1, opt_delete_master_logs=0, tty_password=0, opt_single_transaction=0, opt_comments= 0, opt_compact= 0, opt_hex_blob=0, opt_order_by_primary=0, opt_ignore=0, - opt_complete_insert= 0; + opt_complete_insert= 0, opt_drop_database= 0; static ulong opt_max_allowed_packet, opt_net_buffer_length; static MYSQL mysql_connection,*sock=0; static my_bool insert_pat_inited=0; @@ -159,6 +159,9 @@ static struct my_option my_long_options[] = "Dump all the databases. This will be same as --databases with all databases selected.", (gptr*) &opt_alldbs, (gptr*) &opt_alldbs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"add-drop-database", OPT_DROP_DATABASE, "Add a 'DROP DATABASE' before each create.", + (gptr*) &opt_drop_database, (gptr*) &opt_drop_database, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, + 0}, {"add-drop-table", OPT_DROP, "Add a 'drop table' before each create.", (gptr*) &opt_drop, (gptr*) &opt_drop, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, @@ -1119,9 +1122,9 @@ static uint getTableStructure(char *table, char* db) else dynstr_set(&insert_pat, ""); - insert_option= (opt_delayed && opt_ignore) ? " DELAYED IGNORE " : - opt_delayed ? " DELAYED " : - opt_ignore ? " IGNORE " : ""; + insert_option= ((opt_delayed && opt_ignore) ? " DELAYED IGNORE " : + opt_delayed ? " DELAYED " : + opt_ignore ? " IGNORE " : ""); if (verbose) fprintf(stderr, "-- Retrieving table structure for table %s...\n", table); @@ -2043,12 +2046,20 @@ static int init_dumping(char *database) if (mysql_query(sock, qbuf) || !(dbinfo = mysql_store_result(sock))) { /* Old server version, dump generic CREATE DATABASE */ + if (opt_drop_database) + fprintf(md_result_file, + "\n/*!40000 DROP DATABASE IF EXISTS %s;*/\n", + qdatabase); fprintf(md_result_file, "\nCREATE DATABASE /*!32312 IF NOT EXISTS*/ %s;\n", qdatabase); } else { + if (opt_drop_database) + fprintf(md_result_file, + "\n/*!40000 DROP DATABASE IF EXISTS %s*/;\n", + qdatabase); row = mysql_fetch_row(dbinfo); if (row[1]) { diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result index 493c6d6404a..845b0d1da45 100644 --- a/mysql-test/r/mysqldump.result +++ b/mysql-test/r/mysqldump.result @@ -1311,3 +1311,41 @@ UNLOCK TABLES; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; drop table t1; +CREATE TABLE t1 (a int); +INSERT INTO t1 VALUES (1),(2),(3); + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +/*!40000 DROP DATABASE IF EXISTS `test`*/; + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 */; + +USE `test`; +DROP TABLE IF EXISTS `t1`; +CREATE TABLE `t1` ( + `a` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + + +/*!40000 ALTER TABLE `t1` DISABLE KEYS */; +LOCK TABLES `t1` WRITE; +INSERT INTO `t1` VALUES (1),(2),(3); +UNLOCK TABLES; +/*!40000 ALTER TABLE `t1` ENABLE KEYS */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +DROP TABLE t1; diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test index 2681e690ff5..9f3b412b814 100644 --- a/mysql-test/t/mysqldump.test +++ b/mysql-test/t/mysqldump.test @@ -534,3 +534,12 @@ create table t1 ( insert into t1 (F_8d3bba7425e7c98c50f52ca1b52d3735) values (1); --exec $MYSQL_DUMP --skip-comments -c test drop table t1; + +# +# Test for --add-drop-database +# + +CREATE TABLE t1 (a int); +INSERT INTO t1 VALUES (1),(2),(3); +--exec $MYSQL_DUMP --add-drop-database --skip-comments --databases test +DROP TABLE t1; From 6a96b815e77ea992d3948151ca7ab59cb95949de Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 24 May 2005 09:01:06 -0500 Subject: [PATCH 03/11] removed unneeded reserved_win_names testcase BitKeeper/deleted/.del-reserved_win_names.test~334b02776c4247a7: Delete: mysql-test/t/reserved_win_names.test BitKeeper/deleted/.del-reserved_win_names.require~be6a130b5430085f: Delete: mysql-test/r/reserved_win_names.require BitKeeper/deleted/.del-reserved_win_names.result~ea458226c0df5337: Delete: mysql-test/r/reserved_win_names.result --- mysql-test/r/reserved_win_names.require | 2 -- mysql-test/r/reserved_win_names.result | 7 ------- mysql-test/t/reserved_win_names.test | 12 ------------ 3 files changed, 21 deletions(-) delete mode 100644 mysql-test/r/reserved_win_names.require delete mode 100644 mysql-test/r/reserved_win_names.result delete mode 100644 mysql-test/t/reserved_win_names.test diff --git a/mysql-test/r/reserved_win_names.require b/mysql-test/r/reserved_win_names.require deleted file mode 100644 index 7f803aca482..00000000000 --- a/mysql-test/r/reserved_win_names.require +++ /dev/null @@ -1,2 +0,0 @@ -Variable_name Value -lower_case_table_names 1 diff --git a/mysql-test/r/reserved_win_names.result b/mysql-test/r/reserved_win_names.result deleted file mode 100644 index eaa0f71513f..00000000000 --- a/mysql-test/r/reserved_win_names.result +++ /dev/null @@ -1,7 +0,0 @@ -use COM1; -ERROR 42000: Unknown database 'com1' -use LPT1; -ERROR 42000: Unknown database 'lpt1' -use PRN; -ERROR 42000: Unknown database 'prn' - diff --git a/mysql-test/t/reserved_win_names.test b/mysql-test/t/reserved_win_names.test deleted file mode 100644 index d9b23935ddf..00000000000 --- a/mysql-test/t/reserved_win_names.test +++ /dev/null @@ -1,12 +0,0 @@ -# -# Test of reserved Windows names -# ---require r/reserved_win_names.require - ---error 1049 -use COM1; ---error 1049 -use LPT1; ---error 1049 -use PRN; - From 801c2c275a471ac37a6e520f6da737ffd2dbb16f Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 24 May 2005 17:50:17 +0300 Subject: [PATCH 04/11] Added a test case for Bug#8009. sql/item.cc: Fixed Bug#8009. --- mysql-test/r/select.result | 6 ++++++ mysql-test/t/select.test | 9 +++++++++ sql/item.cc | 1 + 3 files changed, 16 insertions(+) diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index c39d1a322e4..f828759672a 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -2509,3 +2509,9 @@ AND FK_firma_id = 2; COUNT(*) 0 drop table t1; +CREATE TABLE t1 (b BIGINT(20) UNSIGNED NOT NULL, PRIMARY KEY (b)); +INSERT INTO t1 VALUES (0x8000000000000000); +SELECT b FROM t1 WHERE b=0x8000000000000000; +b +9223372036854775808 +DROP TABLE t1; diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test index 0634323cef7..3877e67de41 100644 --- a/mysql-test/t/select.test +++ b/mysql-test/t/select.test @@ -2051,3 +2051,12 @@ SELECT COUNT(*) FROM t1 WHERE AND FK_firma_id = 2; drop table t1; + +# +# Test for Bug#8009, SELECT failed on bigint unsigned when using HEX +# + +CREATE TABLE t1 (b BIGINT(20) UNSIGNED NOT NULL, PRIMARY KEY (b)); +INSERT INTO t1 VALUES (0x8000000000000000); +SELECT b FROM t1 WHERE b=0x8000000000000000; +DROP TABLE t1; diff --git a/sql/item.cc b/sql/item.cc index 59785813566..c43421117e5 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -2107,6 +2107,7 @@ Item_varbinary::Item_varbinary(const char *str, uint str_length) *ptr=0; // Keep purify happy collation.set(&my_charset_bin, DERIVATION_COERCIBLE); fixed= 1; + unsigned_flag= 1; } longlong Item_varbinary::val_int() From d3f7ec30897868e6dbb724ff1c308b0fc7f5fe14 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 24 May 2005 21:02:42 +0200 Subject: [PATCH 05/11] simplifying new/my_arg_new wrapping --- include/my_global.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/my_global.h b/include/my_global.h index f059d603976..d7cda085353 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -289,12 +289,14 @@ C_MODE_START int __cxa_pure_virtual() {\ #endif #if defined(__ia64__) #define new my_arg_new +#define need_to_restore_new 1 #endif C_MODE_START #include C_MODE_END -#if defined(__ia64__) +#ifdef need_to_restore_new /* probably safer than #ifdef new */ #undef new +#undef need_to_restore_new #endif #endif #include /* Recommended by debian */ From 5b77d9b8f3ff262fffca273781e74a9a10f345bf Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 25 May 2005 12:18:18 +1000 Subject: [PATCH 06/11] BUG#10796 Incorrect check-cpu result for ppc linux gcc BUILD/check-cpu: Add no_march variable to indicate that this architecture doesn't support the -march flag to GCC --- BUILD/check-cpu | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/BUILD/check-cpu b/BUILD/check-cpu index 7619224314b..0283c669fb2 100755 --- a/BUILD/check-cpu +++ b/BUILD/check-cpu @@ -72,6 +72,7 @@ case "$cpu_family--$model_name" in ;; *ppc) cpu_flag="powerpc"; + no_march=1; ;; *) cpu_flag=""; @@ -106,6 +107,9 @@ case "$cc_ver--$cc_verno" in cpu_flag="$cpu_flag_old" fi check_cpu_cflags="-mcpu=$cpu_flag -march=$cpu_flag" + if test -n "$no_march"; then + check_cpu_cflags="-mcpu=$cpu_flag" + fi ;; *) check_cpu_cflags="" From 605f7061dc2ca28d78ad652b9b5a7225f55ccb9a Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 25 May 2005 15:35:51 +1000 Subject: [PATCH 07/11] BUG#10831 ndb mgmd LogDestination maxfiles does not rotate logs properly ndb/src/common/util/File.cpp: my_stat returns NULL on failure, not non-zero. i.e. exactly the opposite of stat(2). providing confusion for unix programmers, who expect errors to be non-zero. Clean up File_class::exists(char*) to use the my_stat interface properly. --- ndb/src/common/util/File.cpp | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-) diff --git a/ndb/src/common/util/File.cpp b/ndb/src/common/util/File.cpp index 937b8c0fa59..e514ad8e122 100644 --- a/ndb/src/common/util/File.cpp +++ b/ndb/src/common/util/File.cpp @@ -28,29 +28,9 @@ bool File_class::exists(const char* aFileName) { - bool rc = true; -#ifdef USE_MY_STAT_STRUCT - struct my_stat stmp; -#else - struct stat stmp; -#endif - if (my_stat(aFileName, &stmp, MYF(0)) != 0) - { - rc = false; - } - - /* - File f; - if (!f.open(aFileName, "r")) - { - rc = (errno == ENOENT ? false : true); - } - else - { - f.close(); - } - */ - return rc; + MY_STAT stmp; + + return (my_stat(aFileName, &stmp, MYF(0))!=NULL); } long From ce11270fc1aad781f066f33d28328bde31487dca Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 25 May 2005 16:24:07 +0200 Subject: [PATCH 08/11] Added a missing "make clean" to the RPM "spec" file which had caused the original 4.1.12 RPMs to be broken. (bug#10674, bug#10681) support-files/mysql.spec.sh: Added a missing "make clean" which had caused the original 4.1.12 RPMs to be broken. (bug#10674, bug#10681) --- support-files/mysql.spec.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index 8b880c32051..2354b44f4fa 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -299,6 +299,9 @@ fi (cd libmysql/.libs; tar cf $RBR/shared-libs.tar *.so*) (cd libmysql_r/.libs; tar rf $RBR/shared-libs.tar *.so*) +# Now clean up +make clean + # RPM:s destroys Makefile.in files, so we generate them here # aclocal; autoheader; aclocal; automake; autoconf # (cd innobase && aclocal && autoheader && aclocal && automake && autoconf) @@ -584,6 +587,10 @@ fi # itself - note that they must be ordered by date (important when # merging BK trees) %changelog +* Wed May 25 2005 Joerg Bruehe + +- Added a "make clean" between separate calls to "BuildMySQL". + * Wed Apr 13 2005 Lenz Grimmer - removed the MySQL manual files (html/ps/texi) - they have been removed From 1c8b1af142cc8c5ca3e59262944b93000cf74304 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 26 May 2005 12:55:31 +0200 Subject: [PATCH 09/11] Merge mysql-test/t/select.test: SCCS merged --- mysql-test/t/select.test | 217 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 206 insertions(+), 11 deletions(-) diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test index 3877e67de41..b6132d23d02 100644 --- a/mysql-test/t/select.test +++ b/mysql-test/t/select.test @@ -9,7 +9,8 @@ --disable_warnings drop table if exists t1,t2,t3,t4; # The following may be left from older tests -drop table if exists t1_1,t1_2,t9_1,t9_2; +drop table if exists t1_1,t1_2,t9_1,t9_2,t1aa,t2aa; +drop view if exists v1; --enable_warnings CREATE TABLE t1 ( @@ -1764,9 +1765,9 @@ DO benchmark(100,1+1),1,1; # Bug #6449: do default; # ---error 1064 +--error ER_PARSE_ERROR do default; ---error 1054 +--error ER_BAD_FIELD_ERROR do foobar; # @@ -1792,7 +1793,10 @@ CREATE TABLE t1 (gvid int(10) unsigned default NULL, hmid int(10) unsigned defa INSERT INTO t1 VALUES (200001,2,1,1,100,1,1,1,0,0,0,1,0,1,20020425060057,'\\\\ARKIVIO-TESTPDC\\E$',''),(200002,2,2,1,101,1,1,1,0,0,0,1,0,1,20020425060057,'\\\\ARKIVIO-TESTPDC\\C$',''),(200003,1,3,2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,0,1,20020425060427,'c:',NULL); CREATE TABLE t2 ( hmid int(10) unsigned default NULL, volid int(10) unsigned default NULL, sampletid smallint(5) unsigned default NULL, sampletime datetime default NULL, samplevalue bigint(20) unsigned default NULL, KEY idx1 (hmid,volid,sampletid,sampletime)) ENGINE=MyISAM; INSERT INTO t2 VALUES (1,3,10,'2002-06-01 08:00:00',35),(1,3,1010,'2002-06-01 12:00:01',35); +# Disable PS becasue we get more warnings from PS than from normal execution +--disable_ps_protocol SELECT a.gvid, (SUM(CASE b.sampletid WHEN 140 THEN b.samplevalue ELSE 0 END)) as the_success,(SUM(CASE b.sampletid WHEN 141 THEN b.samplevalue ELSE 0 END)) as the_fail,(SUM(CASE b.sampletid WHEN 142 THEN b.samplevalue ELSE 0 END)) as the_size,(SUM(CASE b.sampletid WHEN 143 THEN b.samplevalue ELSE 0 END)) as the_time FROM t1 a, t2 b WHERE a.hmid = b.hmid AND a.volid = b.volid AND b.sampletime >= 'wrong-date-value' AND b.sampletime < 'wrong-date-value' AND b.sampletid IN (140, 141, 142, 143) GROUP BY a.gvid; +--enable_ps_protocol # Testing the same select with NULL's instead of invalid datetime values SELECT a.gvid, (SUM(CASE b.sampletid WHEN 140 THEN b.samplevalue ELSE 0 END)) as the_success,(SUM(CASE b.sampletid WHEN 141 THEN b.samplevalue ELSE 0 END)) as the_fail,(SUM(CASE b.sampletid WHEN 142 THEN b.samplevalue ELSE 0 END)) as the_size,(SUM(CASE b.sampletid WHEN 143 THEN b.samplevalue ELSE 0 END)) as the_time FROM t1 a, t2 b WHERE a.hmid = b.hmid AND a.volid = b.volid AND b.sampletime >= NULL AND b.sampletime < NULL AND b.sampletid IN (140, 141, 142, 143) GROUP BY a.gvid; DROP TABLE t1,t2; @@ -1935,6 +1939,205 @@ EXPLAIN SELECT i FROM t1 WHERE i=1; DROP TABLE t1; +# +# Test case for bug 7520: a wrong cost of the index for a BLOB field +# + +CREATE TABLE t1 ( a BLOB, INDEX (a(20)) ); +CREATE TABLE t2 ( a BLOB, INDEX (a(20)) ); + +INSERT INTO t1 VALUES ('one'),('two'),('three'),('four'),('five'); +INSERT INTO t2 VALUES ('one'),('two'),('three'),('four'),('five'); + +EXPLAIN SELECT * FROM t1 LEFT JOIN t2 USE INDEX (a) ON t1.a=t2.a; +EXPLAIN SELECT * FROM t1 LEFT JOIN t2 FORCE INDEX (a) ON t1.a=t2.a; + +DROP TABLE t1, t2; + + +# +# Test case for bug 7098: substitution of a constant for a string field +# + +CREATE TABLE t1 ( city char(30) ); +INSERT INTO t1 VALUES ('London'); +INSERT INTO t1 VALUES ('Paris'); + +SELECT * FROM t1 WHERE city='London'; +SELECT * FROM t1 WHERE city='london'; +EXPLAIN SELECT * FROM t1 WHERE city='London' AND city='london'; +SELECT * FROM t1 WHERE city='London' AND city='london'; +EXPLAIN SELECT * FROM t1 WHERE city LIKE '%london%' AND city='London'; +SELECT * FROM t1 WHERE city LIKE '%london%' AND city='London'; + +DROP TABLE t1; + +# +# Bug#7425 inconsistent sort order on unsigned columns result of substraction +# + +create table t1 (a int(11) unsigned, b int(11) unsigned); +insert into t1 values (1,0), (1,1), (1,2); +select a-b from t1 order by 1; +select a-b , (a-b < 0) from t1 order by 1; +select a-b as d, (a-b >= 0), b from t1 group by b having d >= 0; +select cast((a - b) as unsigned) from t1 order by 1; +drop table t1; + + +# +# Bug#8733 server accepts malformed query (multiply mentioned distinct) +# +create table t1 (a int(11)); +select all all * from t1; +select distinct distinct * from t1; +--error 1221 +select all distinct * from t1; +--error 1221 +select distinct all * from t1; +drop table t1; + +# + +# +# Test for Bug#8009, SELECT failed on bigint unsigned when using HEX +# + +CREATE TABLE t1 (b BIGINT(20) UNSIGNED NOT NULL, PRIMARY KEY (b)); +INSERT INTO t1 VALUES (0x8000000000000000); +SELECT b FROM t1 WHERE b=0x8000000000000000; +DROP TABLE t1; +# Test for bug #6474 +# + +CREATE TABLE t1 ( +K2C4 varchar(4) character set latin1 collate latin1_bin NOT NULL default '', +K4N4 varchar(4) character set latin1 collate latin1_bin NOT NULL default '0000', +F2I4 int(11) NOT NULL default '0' +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +INSERT INTO t1 VALUES +('W%RT', '0100', 1), +('W-RT', '0100', 1), +('WART', '0100', 1), +('WART', '0200', 1), +('WERT', '0100', 2), +('WORT','0200', 2), +('WT', '0100', 2), +('W_RT', '0100', 2), +('WaRT', '0100', 3), +('WART', '0300', 3), +('WRT' , '0400', 3), +('WURM', '0500', 3), +('W%T', '0600', 4), +('WA%T', '0700', 4), +('WA_T', '0800', 4); + +SELECT K2C4, K4N4, F2I4 FROM t1 + WHERE K2C4 = 'WART' AND + (F2I4 = 2 AND K2C4 = 'WART' OR (F2I4 = 2 OR K4N4 = '0200')); + +SELECT K2C4, K4N4, F2I4 FROM t1 + WHERE K2C4 = 'WART' AND (K2C4 = 'WART' OR K4N4 = '0200'); + +DROP TABLE t1; + +# +# Test case for bug 7520: a wrong cost of the index for a BLOB field +# + +CREATE TABLE t1 ( a BLOB, INDEX (a(20)) ); +CREATE TABLE t2 ( a BLOB, INDEX (a(20)) ); + +INSERT INTO t1 VALUES ('one'),('two'),('three'),('four'),('five'); +INSERT INTO t2 VALUES ('one'),('two'),('three'),('four'),('five'); + +EXPLAIN SELECT * FROM t1 LEFT JOIN t2 USE INDEX (a) ON t1.a=t2.a; +EXPLAIN SELECT * FROM t1 LEFT JOIN t2 FORCE INDEX (a) ON t1.a=t2.a; + +DROP TABLE t1, t2; + + +# +# Test case for bug 7098: substitution of a constant for a string field +# + +CREATE TABLE t1 ( city char(30) ); +INSERT INTO t1 VALUES ('London'); +INSERT INTO t1 VALUES ('Paris'); + +SELECT * FROM t1 WHERE city='London'; +SELECT * FROM t1 WHERE city='london'; +EXPLAIN SELECT * FROM t1 WHERE city='London' AND city='london'; +SELECT * FROM t1 WHERE city='London' AND city='london'; +EXPLAIN SELECT * FROM t1 WHERE city LIKE '%london%' AND city='London'; +SELECT * FROM t1 WHERE city LIKE '%london%' AND city='London'; + +DROP TABLE t1; + +# +# Bug#7425 inconsistent sort order on unsigned columns result of substraction +# + +create table t1 (a int(11) unsigned, b int(11) unsigned); +insert into t1 values (1,0), (1,1), (1,2); +select a-b from t1 order by 1; +select a-b , (a-b < 0) from t1 order by 1; +select a-b as d, (a-b >= 0), b from t1 group by b having d >= 0; +select cast((a - b) as unsigned) from t1 order by 1; +drop table t1; + +# +# Bug#8670 +# +create table t1 (a int, b int); +create table t2 like t1; +select t1.a from (t1 inner join t2 on t1.a=t2.a) where t2.a=1; +select t1.a from ((t1 inner join t2 on t1.a=t2.a)) where t2.a=1; +select x.a, y.a, z.a from ( (t1 x inner join t2 y on x.a=y.a) inner join t2 z on y.a=z.a) WHERE x.a=1; +drop table t1,t2; + +# +# Bug#9820 +# + +create table t1 (s1 varchar(5)); +insert into t1 values ('Wall'); +select min(s1) from t1 group by s1 with rollup; +drop table t1; + +# +# Bug#9799 +# + +create table t1 (s1 int) engine=myisam; +insert into t1 values (0); +select avg(distinct s1) from t1 group by s1 with rollup; +drop table t1; + +# +# Bug#9800 +# + +create table t1 (s1 int); +insert into t1 values (null),(1); +select distinct avg(s1) as x from t1 group by s1 with rollup; +drop table t1; + + +# +# Bug#8733 server accepts malformed query (multiply mentioned distinct) +# +create table t1 (a int(11)); +select all all * from t1; +select distinct distinct * from t1; +--error 1221 +select all distinct * from t1; +--error 1221 +select distinct all * from t1; +drop table t1; + + # # Test case for bug 7520: a wrong cost of the index for a BLOB field # @@ -2052,11 +2255,3 @@ AND FK_firma_id = 2; drop table t1; -# -# Test for Bug#8009, SELECT failed on bigint unsigned when using HEX -# - -CREATE TABLE t1 (b BIGINT(20) UNSIGNED NOT NULL, PRIMARY KEY (b)); -INSERT INTO t1 VALUES (0x8000000000000000); -SELECT b FROM t1 WHERE b=0x8000000000000000; -DROP TABLE t1; From 763f04ad1aad4db4e475e7acf9718f96d8da69ad Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 26 May 2005 12:58:55 +0200 Subject: [PATCH 10/11] Correction of merge mishandling in 'client/client_priv.h'. client/client_priv.h: Correction of merge mishandling. --- client/client_priv.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/client_priv.h b/client/client_priv.h index a2f652af273..c8aa7385276 100644 --- a/client/client_priv.h +++ b/client/client_priv.h @@ -49,5 +49,5 @@ enum options_client #ifdef HAVE_NDBCLUSTER_DB OPT_NDBCLUSTER, OPT_NDB_CONNECTSTRING, #endif - ,OPT_IGNORE_TABLE,OPT_INSERT_IGNORE,OPT_DROP_DATABASE,OPT_DROP_DATABASE + OPT_IGNORE_TABLE,OPT_INSERT_IGNORE,OPT_SHOW_WARNINGS,OPT_DROP_DATABASE }; From df16d85926c6cdfe9b59bdf7b7b56e4f343ddec4 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 26 May 2005 16:47:44 +0200 Subject: [PATCH 11/11] Corrected merge error in 'mysql-test/r/select.result': two test blocks inserted in wrong order. mysql-test/r/select.result: Corrected merge error (two test blocks inserted in wrong order). --- mysql-test/r/select.result | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index 6e19fa09d1b..eaed7719673 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -2423,6 +2423,12 @@ ERROR HY000: Incorrect usage of ALL and DISTINCT select distinct all * from t1; ERROR HY000: Incorrect usage of ALL and DISTINCT drop table t1; +CREATE TABLE t1 (b BIGINT(20) UNSIGNED NOT NULL, PRIMARY KEY (b)); +INSERT INTO t1 VALUES (0x8000000000000000); +SELECT b FROM t1 WHERE b=0x8000000000000000; +b +9223372036854775808 +DROP TABLE t1; CREATE TABLE t1 ( K2C4 varchar(4) character set latin1 collate latin1_bin NOT NULL default '', K4N4 varchar(4) character set latin1 collate latin1_bin NOT NULL default '0000', @@ -2676,9 +2682,3 @@ AND FK_firma_id = 2; COUNT(*) 0 drop table t1; -CREATE TABLE t1 (b BIGINT(20) UNSIGNED NOT NULL, PRIMARY KEY (b)); -INSERT INTO t1 VALUES (0x8000000000000000); -SELECT b FROM t1 WHERE b=0x8000000000000000; -b -9223372036854775808 -DROP TABLE t1;