diff options
-rw-r--r-- | client/mysqltest.c | 4 | ||||
-rw-r--r-- | cmd-line-utils/libedit/read.c | 2 | ||||
-rw-r--r-- | configure.in | 2 | ||||
-rw-r--r-- | mysql-test/r/olap.result | 11 | ||||
-rw-r--r-- | mysql-test/r/rpl_log.result | 4 | ||||
-rw-r--r-- | mysql-test/r/rpl_rotate_logs.result | 10 | ||||
-rw-r--r-- | mysql-test/r/select.result | 28 | ||||
-rw-r--r-- | mysql-test/r/timezone_grant.result | 7 | ||||
-rw-r--r-- | mysql-test/t/olap.test | 9 | ||||
-rw-r--r-- | mysql-test/t/select.test | 28 | ||||
-rw-r--r-- | mysql-test/t/timezone_grant.test | 12 | ||||
-rw-r--r-- | sql/mysqld.cc | 8 | ||||
-rw-r--r-- | sql/sql_parse.cc | 5 | ||||
-rw-r--r-- | sql/sql_repl.cc | 2 | ||||
-rw-r--r-- | sql/sql_select.cc | 6 | ||||
-rw-r--r-- | sql/sql_yacc.yy | 2 |
16 files changed, 121 insertions, 19 deletions
diff --git a/client/mysqltest.c b/client/mysqltest.c index 67fa931a3f3..4b8bb047e47 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -3393,10 +3393,10 @@ static void run_query_display_metadata(MYSQL_FIELD *field, uint num_fields, int10_to_str((int) field->type, buff, 10); dynstr_append(ds, buff); dynstr_append_mem(ds, "\t", 1); - int10_to_str((int) field->length, buff, 10); + longlong10_to_str((unsigned int) field->length, buff, 10); dynstr_append(ds, buff); dynstr_append_mem(ds, "\t", 1); - int10_to_str((int) field->max_length, buff, 10); + longlong10_to_str((unsigned int) field->max_length, buff, 10); dynstr_append(ds, buff); dynstr_append_mem(ds, "\t", 1); dynstr_append_mem(ds, (char*) (IS_NOT_NULL(field->flags) ? diff --git a/cmd-line-utils/libedit/read.c b/cmd-line-utils/libedit/read.c index 40093d6647f..051f3e8e42e 100644 --- a/cmd-line-utils/libedit/read.c +++ b/cmd-line-utils/libedit/read.c @@ -478,7 +478,7 @@ el_gets(EditLine *el, int *nread) #endif /* DEBUG_READ */ break; } - if ((uint)cmdnum >= el->el_map.nfunc) { /* BUG CHECK command */ + if ((unsigned int)cmdnum >= el->el_map.nfunc) { /* BUG CHECK command */ #ifdef DEBUG_EDIT (void) fprintf(el->el_errfile, "ERROR: illegal command from key 0%o\r\n", ch); diff --git a/configure.in b/configure.in index 59a87c8705a..d34d8bd75e7 100644 --- a/configure.in +++ b/configure.in @@ -1,7 +1,7 @@ dnl -*- ksh -*- dnl Process this file with autoconf to produce a configure script. -AC_PREREQ(2.58)dnl Minimum Autoconf version required. +AC_PREREQ(2.57)dnl Minimum Autoconf version required. AC_INIT(sql/mysqld.cc) AC_CANONICAL_SYSTEM diff --git a/mysql-test/r/olap.result b/mysql-test/r/olap.result index a19734d55b5..0b422047a49 100644 --- a/mysql-test/r/olap.result +++ b/mysql-test/r/olap.result @@ -576,4 +576,15 @@ EXPLAIN SELECT type FROM v1 GROUP BY type WITH ROLLUP; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 10 Using filesort DROP VIEW v1; +CREATE TABLE t1 (a INT(10) NOT NULL, b INT(10) NOT NULL); +INSERT INTO t1 VALUES (1, 1); +INSERT INTO t1 VALUES (1, 2); +SELECT a, b, a AS c, COUNT(*) AS count FROM t1 GROUP BY a, b, c WITH ROLLUP; +a b c count +1 1 1 1 +1 1 NULL 1 +1 2 1 1 +1 2 NULL 1 +1 NULL NULL 2 +NULL NULL NULL 2 DROP TABLE t1; diff --git a/mysql-test/r/rpl_log.result b/mysql-test/r/rpl_log.result index 5e0eec6305d..bc2e3370019 100644 --- a/mysql-test/r/rpl_log.result +++ b/mysql-test/r/rpl_log.result @@ -69,12 +69,12 @@ master-bin.000002 346 Query 1 434 use `test`; insert into t1 values (1) master-bin.000002 434 Query 1 510 use `test`; drop table t1 show binary logs; Log_name File_size -master-bin.000001 0 +master-bin.000001 1171 master-bin.000002 510 start slave; show binary logs; Log_name File_size -slave-bin.000001 0 +slave-bin.000001 1285 slave-bin.000002 348 show binlog events in 'slave-bin.000001' from 4; Log_name Pos Event_type Server_id End_log_pos Info diff --git a/mysql-test/r/rpl_rotate_logs.result b/mysql-test/r/rpl_rotate_logs.result index a6d3697987a..f1618e246fa 100644 --- a/mysql-test/r/rpl_rotate_logs.result +++ b/mysql-test/r/rpl_rotate_logs.result @@ -27,8 +27,8 @@ insert into t2 values (34),(67),(123); flush logs; show binary logs; Log_name File_size -master-bin.000001 0 -master-bin.000002 0 +master-bin.000001 461 +master-bin.000002 213 master-bin.000003 98 create table t3 select * from temp_table; select * from t3; @@ -43,12 +43,12 @@ start slave; purge master logs to 'master-bin.000002'; show master logs; Log_name File_size -master-bin.000002 0 +master-bin.000002 213 master-bin.000003 407 purge binary logs to 'master-bin.000002'; show binary logs; Log_name File_size -master-bin.000002 0 +master-bin.000002 213 master-bin.000003 407 purge master logs before now(); show binary logs; @@ -74,7 +74,7 @@ count(*) create table t4 select * from temp_table; show binary logs; Log_name File_size -master-bin.000003 0 +master-bin.000003 4167 master-bin.000004 0 master-bin.000005 2032 show master status; diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index d327b491ebf..2a38c5fc86f 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -2757,3 +2757,31 @@ f2 1 NULL drop table t1,t2; +create table t2 (a tinyint unsigned); +create index t2i on t2(a); +insert into t2 values (0), (254), (255); +explain select * from t2 where a > -1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 index t2i t2i 2 NULL 3 Using where; Using index +select * from t2 where a > -1; +a +0 +254 +255 +drop table t2; +CREATE TABLE t1 (a int, b int, c int); +INSERT INTO t1 +SELECT 50, 3, 3 FROM DUAL +WHERE NOT EXISTS +(SELECT * FROM t1 WHERE a = 50 AND b = 3); +SELECT * FROM t1; +a b c +50 3 3 +INSERT INTO t1 +SELECT 50, 3, 3 FROM DUAL +WHERE NOT EXISTS +(SELECT * FROM t1 WHERE a = 50 AND b = 3); +SELECT * FROM t1; +a b c +50 3 3 +DROP TABLE t1; diff --git a/mysql-test/r/timezone_grant.result b/mysql-test/r/timezone_grant.result index dfe0b75ee43..3758f3c2645 100644 --- a/mysql-test/r/timezone_grant.result +++ b/mysql-test/r/timezone_grant.result @@ -47,6 +47,13 @@ select * from mysql.time_zone_name; ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'time_zone_name' select Name, convert_tz('2004-11-30 12:00:00', Name, 'UTC') from mysql.time_zone_name; ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'time_zone_name' +drop table t1, t2; +create table t1 (a int, b datetime); +create table t2 (a int, b varchar(40)); +update t1 set b = '2005-01-01 10:00'; +update t1 set b = convert_tz(b, 'UTC', 'UTC'); +update t1 join t2 on (t1.a = t2.a) set t1.b = '2005-01-01 10:00' where t2.b = 'foo'; +update t1 join t2 on (t1.a = t2.a) set t1.b = convert_tz('2005-01-01 10:00','UTC','UTC') where t2.b = 'foo'; delete from mysql.user where user like 'mysqltest\_%'; delete from mysql.db where user like 'mysqltest\_%'; delete from mysql.tables_priv where user like 'mysqltest\_%'; diff --git a/mysql-test/t/olap.test b/mysql-test/t/olap.test index 26fcc7463d6..78ea56c8090 100644 --- a/mysql-test/t/olap.test +++ b/mysql-test/t/olap.test @@ -265,4 +265,13 @@ SELECT type FROM v1 GROUP BY type WITH ROLLUP; EXPLAIN SELECT type FROM v1 GROUP BY type WITH ROLLUP; DROP VIEW v1; +# Test for bug #11543: ROLLUP query with a repeated column in GROUP BY +# + +CREATE TABLE t1 (a INT(10) NOT NULL, b INT(10) NOT NULL); +INSERT INTO t1 VALUES (1, 1); +INSERT INTO t1 VALUES (1, 2); + +SELECT a, b, a AS c, COUNT(*) AS count FROM t1 GROUP BY a, b, c WITH ROLLUP; + DROP TABLE t1; diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test index 279e6070f06..90f42f3896e 100644 --- a/mysql-test/t/select.test +++ b/mysql-test/t/select.test @@ -2341,3 +2341,31 @@ insert into t2 values (1,2,3),(2,4,6); select A.f2 from t1 left join t2 A on A.f2 = f1 where A.f3=(select min(f3) from t2 C where A.f4 = C.f4) or A.f3 IS NULL; drop table t1,t2; +# +# Bug #11521 Negative integer keys incorrectly substituted for 0 during +# range analysis. + +create table t2 (a tinyint unsigned); +create index t2i on t2(a); +insert into t2 values (0), (254), (255); +explain select * from t2 where a > -1; +select * from t2 where a > -1; +drop table t2; + +# +# Bug #11745: SELECT ... FROM DUAL with WHERE condition +# + +CREATE TABLE t1 (a int, b int, c int); +INSERT INTO t1 + SELECT 50, 3, 3 FROM DUAL + WHERE NOT EXISTS + (SELECT * FROM t1 WHERE a = 50 AND b = 3); +SELECT * FROM t1; +INSERT INTO t1 + SELECT 50, 3, 3 FROM DUAL + WHERE NOT EXISTS + (SELECT * FROM t1 WHERE a = 50 AND b = 3); +SELECT * FROM t1; + +DROP TABLE t1; diff --git a/mysql-test/t/timezone_grant.test b/mysql-test/t/timezone_grant.test index f586ba0c5fe..5dbf457e1f1 100644 --- a/mysql-test/t/timezone_grant.test +++ b/mysql-test/t/timezone_grant.test @@ -61,6 +61,18 @@ select * from mysql.time_zone_name; --error 1142 select Name, convert_tz('2004-11-30 12:00:00', Name, 'UTC') from mysql.time_zone_name; +# +# Bug #9979: Use of CONVERT_TZ in multiple-table UPDATE causes bogus +# privilege error +# +drop table t1, t2; +create table t1 (a int, b datetime); +create table t2 (a int, b varchar(40)); +update t1 set b = '2005-01-01 10:00'; +update t1 set b = convert_tz(b, 'UTC', 'UTC'); +update t1 join t2 on (t1.a = t2.a) set t1.b = '2005-01-01 10:00' where t2.b = 'foo'; +update t1 join t2 on (t1.a = t2.a) set t1.b = convert_tz('2005-01-01 10:00','UTC','UTC') where t2.b = 'foo'; + # Clean-up connection default; delete from mysql.user where user like 'mysqltest\_%'; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 035f098c88c..7c8b2b781e4 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -685,7 +685,13 @@ static void close_connections(void) { DBUG_PRINT("quit",("Informing thread %ld that it's time to die", tmp->thread_id)); - tmp->killed= THD::KILL_CONNECTION; + /* + Re: bug 7403 - close_connection will be called mulitple times + a wholesale clean up of our network code is a very large project. + This will wake up the socket on Windows and prevent the printing of + the error message that we are force closing a connection. + */ + close_connection(tmp, 0, 0); if (tmp->mysys_var) { tmp->mysys_var->abort=1; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 26f342eac54..d8c7507fd35 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2304,7 +2304,8 @@ mysql_execute_command(THD *thd) Don't reset warnings when executing a stored routine. */ if ((all_tables || &lex->select_lex != lex->all_selects_list || - lex->sroutines.records) && !thd->spcont) + lex->sroutines.records) && !thd->spcont || + lex->time_zone_tables_used) mysql_reset_errors(thd, 0); #ifdef HAVE_REPLICATION @@ -6843,7 +6844,7 @@ bool multi_update_precheck(THD *thd, TABLE_LIST *tables) /* Is there tables of subqueries? */ - if (&lex->select_lex != lex->all_selects_list) + if (&lex->select_lex != lex->all_selects_list || lex->time_zone_tables_used) { DBUG_PRINT("info",("Checking sub query list")); for (table= tables; table; table= table->next_global) diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 87bf5463ffa..32a8378d41d 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -1526,7 +1526,7 @@ bool show_binlogs(THD* thd) else { /* this is an old log, open it and find the size */ - if ((file= my_open(fname+dir_len, O_RDONLY | O_SHARE | O_BINARY, + if ((file= my_open(fname, O_RDONLY | O_SHARE | O_BINARY, MYF(0))) >= 0) { file_length= (ulonglong) my_seek(file, 0L, MY_SEEK_END, MYF(0)); diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 6c59c12e653..b333e369dc4 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -1198,7 +1198,7 @@ JOIN::exec() { result->send_fields(fields_list, Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF); - if (!having || having->val_int()) + if (cond_value != Item::COND_FALSE && (!having || having->val_int())) { if (do_send_rows && (procedure ? (procedure->send_row(fields_list) || procedure->end_of_records()) @@ -13065,7 +13065,7 @@ bool JOIN::rollup_init() ORDER *group_tmp; for (group_tmp= group_list; group_tmp; group_tmp= group_tmp->next) { - if (item->eq(*group_tmp->item,0)) + if (*group_tmp->item == item) item->maybe_null= 1; } if (item->type() == Item::FUNC_ITEM) @@ -13185,7 +13185,7 @@ bool JOIN::rollup_make_fields(List<Item> &fields_arg, List<Item> &sel_fields, for (group_tmp= start_group, i= pos ; group_tmp ; group_tmp= group_tmp->next, i++) { - if (item->eq(*group_tmp->item,0)) + if (*group_tmp->item == item) { /* This is an element that is used by the GROUP BY and should be diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 8bb695c7c2b..f35a47bf397 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -4026,7 +4026,7 @@ select_into: select_from: FROM join_table_list where_clause group_clause having_clause opt_order_clause opt_limit_clause procedure_clause - | FROM DUAL_SYM opt_limit_clause + | FROM DUAL_SYM where_clause opt_limit_clause /* oracle compatibility: oracle always requires FROM clause, and DUAL is system table without fields. Is "SELECT 1 FROM DUAL" any better than "SELECT 1" ? |