diff options
50 files changed, 285 insertions, 247 deletions
diff --git a/myisam/mi_check.c b/myisam/mi_check.c index 2015bcc7ec0..052fa55a559 100644 --- a/myisam/mi_check.c +++ b/myisam/mi_check.c @@ -2702,7 +2702,7 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param) char llbuff[22],llbuff2[22]; DBUG_ENTER("sort_get_next_record"); - if (*killed_ptr(param->thd)) + if (*killed_ptr(param)) DBUG_RETURN(1); switch (share->data_file_type) { diff --git a/myisam/sort.c b/myisam/sort.c index 334f735599f..b79a18f0a65 100644 --- a/myisam/sort.c +++ b/myisam/sort.c @@ -852,7 +852,7 @@ merge_buffers(MI_SORT_PARAM *info, uint keys, IO_CACHE *from_file, uchar *strpos; BUFFPEK *buffpek,**refpek; QUEUE queue; - int *killed= killed_ptr(info->sort_info->param->thd); + int *killed= killed_ptr(info->sort_info->param); DBUG_ENTER("merge_buffers"); diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh index 811d56ba6fe..6684ac6b9ed 100644 --- a/mysql-test/mysql-test-run.sh +++ b/mysql-test/mysql-test-run.sh @@ -527,8 +527,6 @@ MYSQL_DUMP="$MYSQL_DUMP --no-defaults -uroot --socket=$MASTER_MYSOCK --password= MYSQL_BINLOG="$MYSQL_BINLOG --no-defaults --local-load=$MYSQL_TMP_DIR $EXTRA_MYSQLBINLOG_OPT" MYSQL_FIX_SYSTEM_TABLES="$MYSQL_FIX_SYSTEM_TABLES --no-defaults --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD --basedir=$BASEDIR --bindir=$CLIENT_BINDIR --verbose" MYSQL="$MYSQL --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD" -export MYSQL MYSQL_DUMP MYSQL_BINLOG MYSQL_FIX_SYSTEM_TABLES CLIENT_BINDIR - if [ -z "$MASTER_MYSQLD" ] then @@ -580,6 +578,8 @@ if [ -n "$DO_CLIENT_GDB" -o -n "$DO_GDB" ] ; then XTERM=`which xterm` fi +export MYSQL MYSQL_DUMP MYSQL_BINLOG MYSQL_FIX_SYSTEM_TABLES CLIENT_BINDIR MASTER_MYSOCK + #++ # Function Definitions #-- diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result index ee364bee56c..fd7d0bdae39 100644 --- a/mysql-test/r/func_group.result +++ b/mysql-test/r/func_group.result @@ -321,6 +321,7 @@ insert into t2 values('DEN','Denver','CO','BDL'); insert into t2 values('SDC','San Diego','CA','TWU'); insert into t2 values('NOL','New Orleans','LA','GTM'); insert into t2 values('LAK','Los Angeles','CA','TWU'); +insert into t2 values('AAA','AAA','AA','AME'); select * from t1; a1 a2 a3 a4 a5 AME 0 SEA 0.1 1942-02-19 @@ -345,6 +346,7 @@ DEN Denver CO BDL SDC San Diego CA TWU NOL New Orleans LA GTM LAK Los Angeles CA TWU +AAA AAA AA AME explain select min(a1) from t1; id select_type table type possible_keys key key_len ref rows Extra diff --git a/mysql-test/r/mysqlbinlog.result b/mysql-test/r/mysqlbinlog.result index 72d7af2ec4f..c18588d90a7 100644 --- a/mysql-test/r/mysqlbinlog.result +++ b/mysql-test/r/mysqlbinlog.result @@ -16,10 +16,9 @@ flush logs; --- Local -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; use test; - +SET TIMESTAMP=1000000000; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; SET @@session.sql_mode=0; -SET TIMESTAMP=1000000000; drop table if exists t1,t2; SET TIMESTAMP=1000000000; create table t1 (word varchar(20)); @@ -60,10 +59,10 @@ insert into t1 values ("Alas"); /*!40019 SET @@session.max_insert_delayed_threads=0*/; use test; SET TIMESTAMP=1000000000; -drop table if exists t1,t2; -SET TIMESTAMP=1000000000; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; SET @@session.sql_mode=0; +drop table if exists t1,t2; +SET TIMESTAMP=1000000000; create table t1 (word varchar(20)); SET TIMESTAMP=1000000000; create table t2 (id int auto_increment not null primary key); diff --git a/mysql-test/r/ps_1general.result b/mysql-test/r/ps_1general.result index b9df6187a09..52b887e2795 100644 --- a/mysql-test/r/ps_1general.result +++ b/mysql-test/r/ps_1general.result @@ -418,7 +418,7 @@ def table 253 64 2 N 1 31 63 def type 253 10 3 N 1 31 63 def possible_keys 253 4096 0 Y 0 31 63 def key 253 64 0 Y 0 31 63 -def key_len 8 3 0 Y 32800 0 8 +def key_len 253 4096 0 Y 0 31 63 def ref 253 1024 0 Y 0 31 63 def rows 8 10 1 N 32801 0 8 def Extra 253 255 14 N 1 31 63 @@ -434,7 +434,7 @@ def table 253 64 2 N 1 31 63 def type 253 10 5 N 1 31 63 def possible_keys 253 4096 7 Y 0 31 63 def key 253 64 7 Y 0 31 63 -def key_len 8 3 1 Y 32800 0 8 +def key_len 253 4096 1 Y 0 31 63 def ref 253 1024 0 Y 0 31 63 def rows 8 10 1 N 32801 0 8 def Extra 253 255 27 N 1 31 63 diff --git a/mysql-test/r/ps_2myisam.result b/mysql-test/r/ps_2myisam.result index d630730d96f..caac78e09d0 100644 --- a/mysql-test/r/ps_2myisam.result +++ b/mysql-test/r/ps_2myisam.result @@ -567,7 +567,7 @@ def table 253 64 16 N 1 31 63 def type 253 10 3 N 1 31 63 def possible_keys 253 4096 0 Y 0 31 63 def key 253 64 0 Y 0 31 63 -def key_len 8 3 0 Y 32800 0 8 +def key_len 253 4096 0 Y 0 31 63 def ref 253 1024 0 Y 0 31 63 def rows 8 10 1 N 32801 0 8 def Extra 253 255 44 N 1 31 63 @@ -638,7 +638,7 @@ def table 253 64 16 N 1 31 63 def type 253 10 3 N 1 31 63 def possible_keys 253 4096 0 Y 0 31 63 def key 253 64 0 Y 0 31 63 -def key_len 8 3 0 Y 32800 0 8 +def key_len 253 4096 0 Y 0 31 63 def ref 253 1024 0 Y 0 31 63 def rows 8 10 1 N 32801 0 8 def Extra 253 255 44 N 1 31 63 diff --git a/mysql-test/r/ps_3innodb.result b/mysql-test/r/ps_3innodb.result index 8cba3501a73..cfd1f82eefd 100644 --- a/mysql-test/r/ps_3innodb.result +++ b/mysql-test/r/ps_3innodb.result @@ -548,15 +548,15 @@ def in_s 8 21 1 Y 32768 0 8 def in_row_s 8 21 1 Y 32768 0 8 scalar_s exists_s in_s in_row_s 2.0000 0 1 0 -18.0000 1 0 1 2.0000 0 1 0 18.0000 1 0 1 +18.0000 1 0 1 execute stmt1 ; scalar_s exists_s in_s in_row_s 2.0000 0 1 0 -18.0000 1 0 1 2.0000 0 1 0 18.0000 1 0 1 +18.0000 1 0 1 set @stmt= concat('explain ',@stmt); prepare stmt1 from @stmt ; execute stmt1 ; @@ -567,13 +567,13 @@ def table 253 64 16 N 1 31 63 def type 253 10 3 N 1 31 63 def possible_keys 253 4096 0 Y 0 31 63 def key 253 64 0 Y 0 31 63 -def key_len 8 3 0 Y 32800 0 8 +def key_len 253 4096 0 Y 0 31 63 def ref 253 1024 0 Y 0 31 63 def rows 8 10 1 N 32801 0 8 def Extra 253 255 44 N 1 31 63 id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 3 -1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where +1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 +1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 3 Using where 6 DERIVED t2 ALL NULL NULL NULL NULL 2 5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where 4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where @@ -581,8 +581,8 @@ id select_type table type possible_keys key key_len ref rows Extra 2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort execute stmt1 ; id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 3 -1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where +1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 +1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 3 Using where 6 DERIVED t2 ALL NULL NULL NULL NULL 2 5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where 4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where @@ -617,16 +617,16 @@ def in_s 8 21 1 Y 32768 0 8 def in_row_s 8 21 1 Y 32768 0 8 scalar_s exists_s in_s in_row_s 2 0 1 0 -18 1 0 1 2 0 1 0 18 1 0 1 +18 1 0 1 execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08, @arg09 ; scalar_s exists_s in_s in_row_s 2 0 1 0 -18 1 0 1 2 0 1 0 18 1 0 1 +18 1 0 1 set @stmt= concat('explain ',@stmt); prepare stmt1 from @stmt ; execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @@ -638,13 +638,13 @@ def table 253 64 16 N 1 31 63 def type 253 10 3 N 1 31 63 def possible_keys 253 4096 0 Y 0 31 63 def key 253 64 0 Y 0 31 63 -def key_len 8 3 0 Y 32800 0 8 +def key_len 253 4096 0 Y 0 31 63 def ref 253 1024 0 Y 0 31 63 def rows 8 10 1 N 32801 0 8 def Extra 253 255 44 N 1 31 63 id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 3 -1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where +1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 +1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 3 Using where 6 DERIVED t2 ALL NULL NULL NULL NULL 2 5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where 4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where @@ -653,8 +653,8 @@ id select_type table type possible_keys key key_len ref rows Extra execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08, @arg09 ; id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 3 -1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where +1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 +1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 3 Using where 6 DERIVED t2 ALL NULL NULL NULL NULL 2 5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where 4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where diff --git a/mysql-test/r/ps_4heap.result b/mysql-test/r/ps_4heap.result index 112ef86a681..0fe3b95f8a8 100644 --- a/mysql-test/r/ps_4heap.result +++ b/mysql-test/r/ps_4heap.result @@ -568,7 +568,7 @@ def table 253 64 16 N 1 31 63 def type 253 10 3 N 1 31 63 def possible_keys 253 4096 0 Y 0 31 63 def key 253 64 0 Y 0 31 63 -def key_len 8 3 0 Y 32800 0 8 +def key_len 253 4096 0 Y 0 31 63 def ref 253 1024 0 Y 0 31 63 def rows 8 10 1 N 32801 0 8 def Extra 253 255 44 N 1 31 63 @@ -639,7 +639,7 @@ def table 253 64 16 N 1 31 63 def type 253 10 3 N 1 31 63 def possible_keys 253 4096 0 Y 0 31 63 def key 253 64 0 Y 0 31 63 -def key_len 8 3 0 Y 32800 0 8 +def key_len 253 4096 0 Y 0 31 63 def ref 253 1024 0 Y 0 31 63 def rows 8 10 1 N 32801 0 8 def Extra 253 255 44 N 1 31 63 diff --git a/mysql-test/r/ps_5merge.result b/mysql-test/r/ps_5merge.result index 8fc035b0aef..a4b01993e76 100644 --- a/mysql-test/r/ps_5merge.result +++ b/mysql-test/r/ps_5merge.result @@ -610,7 +610,7 @@ def table 253 64 16 N 1 31 63 def type 253 10 3 N 1 31 63 def possible_keys 253 4096 0 Y 0 31 63 def key 253 64 0 Y 0 31 63 -def key_len 8 3 0 Y 32800 0 8 +def key_len 253 4096 0 Y 0 31 63 def ref 253 1024 0 Y 0 31 63 def rows 8 10 1 N 32801 0 8 def Extra 253 255 44 N 1 31 63 @@ -681,7 +681,7 @@ def table 253 64 16 N 1 31 63 def type 253 10 3 N 1 31 63 def possible_keys 253 4096 0 Y 0 31 63 def key 253 64 0 Y 0 31 63 -def key_len 8 3 0 Y 32800 0 8 +def key_len 253 4096 0 Y 0 31 63 def ref 253 1024 0 Y 0 31 63 def rows 8 10 1 N 32801 0 8 def Extra 253 255 44 N 1 31 63 @@ -1793,7 +1793,7 @@ def table 253 64 16 N 1 31 63 def type 253 10 3 N 1 31 63 def possible_keys 253 4096 0 Y 0 31 63 def key 253 64 0 Y 0 31 63 -def key_len 8 3 0 Y 32800 0 8 +def key_len 253 4096 0 Y 0 31 63 def ref 253 1024 0 Y 0 31 63 def rows 8 10 1 N 32801 0 8 def Extra 253 255 44 N 1 31 63 @@ -1864,7 +1864,7 @@ def table 253 64 16 N 1 31 63 def type 253 10 3 N 1 31 63 def possible_keys 253 4096 0 Y 0 31 63 def key 253 64 0 Y 0 31 63 -def key_len 8 3 0 Y 32800 0 8 +def key_len 253 4096 0 Y 0 31 63 def ref 253 1024 0 Y 0 31 63 def rows 8 10 1 N 32801 0 8 def Extra 253 255 44 N 1 31 63 diff --git a/mysql-test/r/ps_6bdb.result b/mysql-test/r/ps_6bdb.result index eeabd114b91..ef4c1aeaa43 100644 --- a/mysql-test/r/ps_6bdb.result +++ b/mysql-test/r/ps_6bdb.result @@ -567,7 +567,7 @@ def table 253 64 16 N 1 31 63 def type 253 10 3 N 1 31 63 def possible_keys 253 4096 0 Y 0 31 63 def key 253 64 0 Y 0 31 63 -def key_len 8 3 0 Y 32800 0 8 +def key_len 253 4096 0 Y 0 31 63 def ref 253 1024 0 Y 0 31 63 def rows 8 10 1 N 32801 0 8 def Extra 253 255 44 N 1 31 63 @@ -638,7 +638,7 @@ def table 253 64 16 N 1 31 63 def type 253 10 3 N 1 31 63 def possible_keys 253 4096 0 Y 0 31 63 def key 253 64 0 Y 0 31 63 -def key_len 8 3 0 Y 32800 0 8 +def key_len 253 4096 0 Y 0 31 63 def ref 253 1024 0 Y 0 31 63 def rows 8 10 1 N 32801 0 8 def Extra 253 255 44 N 1 31 63 diff --git a/mysql-test/r/rpl_flush_log_loop.result b/mysql-test/r/rpl_flush_log_loop.result index cf588634132..4b73458386d 100644 --- a/mysql-test/r/rpl_flush_log_loop.result +++ b/mysql-test/r/rpl_flush_log_loop.result @@ -14,4 +14,4 @@ start slave; flush logs; show slave status; Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master -# 127.0.0.1 root SLAVE_PORT 60 slave-bin.000001 95 # # slave-bin.000001 Yes Yes 0 0 95 # None 0 No # +# 127.0.0.1 root SLAVE_PORT 60 slave-bin.000001 199 # # slave-bin.000001 Yes Yes 0 0 199 # None 0 No # diff --git a/mysql-test/r/rpl_replicate_do.result b/mysql-test/r/rpl_replicate_do.result index a06125362c2..5cdcb6f30fb 100644 --- a/mysql-test/r/rpl_replicate_do.result +++ b/mysql-test/r/rpl_replicate_do.result @@ -28,4 +28,4 @@ ERROR 42S02: Table 'test.t11' doesn't exist drop table if exists t1,t2,t11; show slave status; Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master -# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1473 # # master-bin.000001 Yes Yes test.t1 0 0 1473 # None 0 No # +# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1554 # # master-bin.000001 Yes Yes test.t1 0 0 1554 # None 0 No # diff --git a/mysql-test/r/rpl_temporary.result b/mysql-test/r/rpl_temporary.result index 678b983104f..3e8c11883be 100644 --- a/mysql-test/r/rpl_temporary.result +++ b/mysql-test/r/rpl_temporary.result @@ -39,17 +39,18 @@ f show binlog events; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 4 Format_desc 1 95 Server ver: VERSION, Binlog ver: 4 -master-bin.000001 95 Query 1 174 use `test`; create table t1(f int) -master-bin.000001 174 Query 1 253 use `test`; create table t2(f int) -master-bin.000001 253 Query 1 372 use `test`; insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10) -master-bin.000001 372 Query 1 461 use `test`; create temporary table t3(f int) -master-bin.000001 461 Query 1 559 use `test`; insert into t3 select * from t1 where f<6 -master-bin.000001 559 Query 1 648 use `test`; create temporary table t3(f int) -master-bin.000001 648 Query 1 743 use `test`; insert into t2 select count(*) from t3 -master-bin.000001 743 Query 1 842 use `test`; insert into t3 select * from t1 where f>=4 -master-bin.000001 842 Query 1 922 use `test`; drop temporary table t3 -master-bin.000001 922 Query 1 1017 use `test`; insert into t2 select count(*) from t3 -master-bin.000001 1017 Query 1 1097 use `test`; drop temporary table t3 +master-bin.000001 95 Query 1 178 use `test`; drop table if exists t1,t2 +master-bin.000001 178 Query 1 257 use `test`; create table t1(f int) +master-bin.000001 257 Query 1 336 use `test`; create table t2(f int) +master-bin.000001 336 Query 1 455 use `test`; insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10) +master-bin.000001 455 Query 1 544 use `test`; create temporary table t3(f int) +master-bin.000001 544 Query 1 642 use `test`; insert into t3 select * from t1 where f<6 +master-bin.000001 642 Query 1 731 use `test`; create temporary table t3(f int) +master-bin.000001 731 Query 1 826 use `test`; insert into t2 select count(*) from t3 +master-bin.000001 826 Query 1 925 use `test`; insert into t3 select * from t1 where f>=4 +master-bin.000001 925 Query 1 1005 use `test`; drop temporary table t3 +master-bin.000001 1005 Query 1 1100 use `test`; insert into t2 select count(*) from t3 +master-bin.000001 1100 Query 1 1180 use `test`; drop temporary table t3 drop table t1, t2; use test; SET TIMESTAMP=1040323920; diff --git a/mysql-test/r/rpl_timezone.result b/mysql-test/r/rpl_timezone.result index c7be3324533..f5ecf474a1a 100644 --- a/mysql-test/r/rpl_timezone.result +++ b/mysql-test/r/rpl_timezone.result @@ -31,14 +31,13 @@ t 2004-01-01 00:00:00 2004-06-11 09:39:02 show binlog events; -Log_name Pos Event_type Server_id Orig_log_pos Info -master-bin.000001 4 Start 1 4 Server ver: VERSION, Binlog ver: 3 -master-bin.000001 79 Query 1 79 use `test`; create table t1 (t timestamp) -master-bin.000001 143 Query 1 143 use `test`; create table t2 (t char(32)) -master-bin.000001 206 Query 1 206 use `test`; SET ONE_SHOT TIME_ZONE='UTC' -master-bin.000001 269 Query 1 269 use `test`; insert into t1 values ('20040101000000'), ('20040611093902') -master-bin.000001 364 Query 1 364 use `test`; delete from t1 -master-bin.000001 413 Query 1 413 use `test`; insert into t1 values ('20040101000000'), ('20040611093902') +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 4 Format_desc 1 95 Server ver: VERSION, Binlog ver: 4 +master-bin.000001 95 Query 1 181 use `test`; create table t1 (t timestamp) +master-bin.000001 181 Query 1 266 use `test`; create table t2 (t char(32)) +master-bin.000001 266 Query 1 383 use `test`; insert into t1 values ('20040101000000'), ('20040611093902') +master-bin.000001 383 Query 1 454 use `test`; delete from t1 +master-bin.000001 454 Query 1 571 use `test`; insert into t1 values ('20040101000000'), ('20040611093902') set time_zone='MET'; insert into t2 (select t from t1); select * from t1; @@ -73,5 +72,4 @@ t 2001-09-09 03:46:40 1000000000 set global time_zone='MET'; -ERROR HY000: Binary logging and replication forbid changing of the global server time zone drop table t1, t2; diff --git a/mysql-test/r/rpl_user_variables.result b/mysql-test/r/rpl_user_variables.result index e1abfbd0bf7..dd9a11e370f 100644 --- a/mysql-test/r/rpl_user_variables.result +++ b/mysql-test/r/rpl_user_variables.result @@ -78,32 +78,32 @@ NULL NULL show binlog events from 179; Log_name Pos Event_type Server_id End_log_pos Info -slave-bin.000001 179 User var 2 222 @i1=12345678901234 -slave-bin.000001 222 User var 2 265 @i2=-12345678901234 -slave-bin.000001 265 User var 2 308 @i3=0 -slave-bin.000001 308 User var 2 351 @i4=-1 +slave-bin.000001 179 User var 2 222 @`i1`=12345678901234 +slave-bin.000001 222 User var 2 265 @`i2`=-12345678901234 +slave-bin.000001 265 User var 2 308 @`i3`=0 +slave-bin.000001 308 User var 2 351 @`i4`=-1 slave-bin.000001 351 Query 1 456 use `test`; insert into t1 values (@i1), (@i2), (@i3), (@i4) -slave-bin.000001 456 User var 2 499 @r1=12.5 -slave-bin.000001 499 User var 2 542 @r2=-12.5 +slave-bin.000001 456 User var 2 499 @`r1`=12.5 +slave-bin.000001 499 User var 2 542 @`r2`=-12.5 slave-bin.000001 542 Query 1 633 use `test`; insert into t1 values (@r1), (@r2) -slave-bin.000001 633 User var 2 682 @s1='This is a test' -slave-bin.000001 682 User var 2 717 @s2='' -slave-bin.000001 717 User var 2 759 @s3='abc'def' -slave-bin.000001 759 User var 2 801 @s4='abc\def' -slave-bin.000001 801 User var 2 843 @s5='abc'def' +slave-bin.000001 633 User var 2 682 @`s1`=_latin1 0x5468697320697320612074657374 COLLATE latin1_swedish_ci +slave-bin.000001 682 User var 2 717 @`s2`=_latin1 "" COLLATE latin1_swedish_ci +slave-bin.000001 717 User var 2 759 @`s3`=_latin1 0x61626327646566 COLLATE latin1_swedish_ci +slave-bin.000001 759 User var 2 801 @`s4`=_latin1 0x6162635C646566 COLLATE latin1_swedish_ci +slave-bin.000001 801 User var 2 843 @`s5`=_latin1 0x61626327646566 COLLATE latin1_swedish_ci slave-bin.000001 843 Query 1 955 use `test`; insert into t1 values (@s1), (@s2), (@s3), (@s4), (@s5) -slave-bin.000001 955 User var 2 981 @n1=NULL +slave-bin.000001 955 User var 2 981 @`n1`=NULL slave-bin.000001 981 Query 1 1065 use `test`; insert into t1 values (@n1) -slave-bin.000001 1065 User var 2 1091 @n2=NULL +slave-bin.000001 1065 User var 2 1091 @`n2`=NULL slave-bin.000001 1091 Query 1 1175 use `test`; insert into t1 values (@n2) slave-bin.000001 1175 Query 1 1285 use `test`; insert into t1 values (@a:=0), (@a:=@a+1), (@a:=@a+1) -slave-bin.000001 1285 User var 2 1327 @a=2 +slave-bin.000001 1285 User var 2 1327 @`a`=2 slave-bin.000001 1327 Query 1 1421 use `test`; insert into t1 values (@a+(@b:=@a+1)) -slave-bin.000001 1421 User var 2 1458 @q='abc' +slave-bin.000001 1421 User var 2 1458 @`q`=_latin1 0x616263 COLLATE latin1_swedish_ci slave-bin.000001 1458 Query 1 1584 use `test`; insert t1 values (@q), (@q:=concat(@q, 'n1')), (@q:=concat(@q, 'n2')) -slave-bin.000001 1584 User var 2 1626 @a=5 +slave-bin.000001 1584 User var 2 1626 @`a`=5 slave-bin.000001 1626 Query 1 1714 use `test`; insert into t1 values (@a),(@a) -slave-bin.000001 1714 User var 2 1739 @a=NULL +slave-bin.000001 1714 User var 2 1739 @`a`=NULL slave-bin.000001 1739 Query 1 1834 use `test`; insert into t1 values (@a),(@a),(@a*5) drop table t1; stop slave; diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index cb251bb64ae..432c5171da5 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -2076,8 +2076,6 @@ gvid the_success the_fail the_size the_time Warnings: Warning 1292 Truncated incorrect datetime value: 'wrong-date-value' Warning 1292 Truncated incorrect datetime value: 'wrong-date-value' -Warning 1292 Truncated incorrect datetime value: 'wrong-date-value' -Warning 1292 Truncated incorrect datetime value: 'wrong-date-value' 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; gvid the_success the_fail the_size the_time DROP TABLE t1,t2; diff --git a/mysql-test/r/sp-error.result b/mysql-test/r/sp-error.result index 59cd93d6e7b..d44360d9b5c 100644 --- a/mysql-test/r/sp-error.result +++ b/mysql-test/r/sp-error.result @@ -1,10 +1,10 @@ delete from mysql.proc; create procedure syntaxerror(t int)| -ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 create procedure syntaxerror(t int)| -ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 create procedure syntaxerror(t int)| -ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 drop table if exists t3| create table t3 ( x int )| insert into t3 values (2), (3)| @@ -44,7 +44,7 @@ call foo()| ERROR 42000: PROCEDURE test.foo does not exist drop procedure if exists foo| Warnings: -Warning 1298 PROCEDURE foo does not exist +Warning 1303 PROCEDURE foo does not exist show create procedure foo| ERROR 42000: PROCEDURE foo does not exist create procedure foo() @@ -80,7 +80,7 @@ declare y int; set x = y; end| Warnings: -Warning 1304 Referring to uninitialized variable y +Warning 1309 Referring to uninitialized variable y drop procedure foo| create procedure foo() return 42| diff --git a/mysql-test/r/sp-security.result b/mysql-test/r/sp-security.result index f78b41764b9..cdcc4595a73 100644 --- a/mysql-test/r/sp-security.result +++ b/mysql-test/r/sp-security.result @@ -28,7 +28,7 @@ select db1_secret.db(); db1_secret.db() db1_secret select * from db1_secret.t1; -ERROR 42000: Access denied for user: 'user1'@'localhost' to database 'db1_secret' +ERROR 42000: Access denied for user 'user1'@'localhost' to database 'db1_secret' create procedure db1_secret.dummy() begin end; ERROR 42000: Unknown database 'db1_secret' drop procedure db1_secret.dummy; @@ -38,7 +38,7 @@ select db1_secret.db(); db1_secret.db() db1_secret select * from db1_secret.t1; -ERROR 42000: Access denied for user: ''@'localhost' to database 'db1_secret' +ERROR 42000: Access denied for user ''@'localhost' to database 'db1_secret' create procedure db1_secret.dummy() begin end; ERROR 42000: Unknown database 'db1_secret' drop procedure db1_secret.dummy; @@ -67,13 +67,13 @@ select db(); db() db1_secret call db1_secret.stamp(5); -ERROR 42000: Access denied for user: 'user1'@'localhost' to database 'db1_secret' +ERROR 42000: Access denied for user 'user1'@'localhost' to database 'db1_secret' select db1_secret.db(); -ERROR 42000: Access denied for user: 'user1'@'localhost' to database 'db1_secret' +ERROR 42000: Access denied for user 'user1'@'localhost' to database 'db1_secret' call db1_secret.stamp(6); -ERROR 42000: Access denied for user: ''@'localhost' to database 'db1_secret' +ERROR 42000: Access denied for user ''@'localhost' to database 'db1_secret' select db1_secret.db(); -ERROR 42000: Access denied for user: ''@'localhost' to database 'db1_secret' +ERROR 42000: Access denied for user ''@'localhost' to database 'db1_secret' drop database if exists db2; create database db2; use db2; @@ -87,10 +87,10 @@ flush privileges; use db2; create procedure p () insert into t2 values (1); call p(); -ERROR 42000: Access denied for user: 'user1'@'localhost' to database 'db2' +ERROR 42000: Access denied for user 'user1'@'localhost' to database 'db2' use db2; call p(); -ERROR 42000: Access denied for user: 'user1'@'localhost' to database 'db2' +ERROR 42000: Access denied for user 'user1'@'localhost' to database 'db2' select * from t2; s1 0 diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index 7f496000644..bbad39c8ad4 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -1075,7 +1075,7 @@ drop table if exists t3| create table t3 (s1 smallint)| insert into t3 values (123456789012)| Warnings: -Warning 1264 Data truncated, out of range for column 's1' at row 1 +Warning 1264 Data truncated; out of range for column 's1' at row 1 create procedure bug2780() begin declare exit handler for sqlwarning set @x = 1; diff --git a/mysql-test/r/user_var.result b/mysql-test/r/user_var.result index 2750478c1c5..9bbfefeb34a 100644 --- a/mysql-test/r/user_var.result +++ b/mysql-test/r/user_var.result @@ -172,19 +172,21 @@ insert into t1 values (@var1); create table t2 (c char(30)) charset=ucs2; set @v=convert('abc' using ucs2); insert into t2 values (@v); -show binlog events from 79; -Log_name Pos Event_type Server_id Orig_log_pos Info -master-bin.000001 79 User var 1 79 @`a b`=_latin1 0x68656C6C6F COLLATE latin1_swedish_ci -master-bin.000001 120 Query 1 120 use `test`; INSERT INTO t1 VALUES(@`a b`) -master-bin.000001 184 User var 1 184 @`var1`=_latin1 0x273B616161 COLLATE latin1_swedish_ci -master-bin.000001 226 Query 1 226 use `test`; insert into t1 values (@var1) -master-bin.000001 290 Query 1 290 use `test`; create table t2 (c char(30)) charset=ucs2 -master-bin.000001 366 User var 1 366 @`v`=_ucs2 0x006100620063 COLLATE ucs2_general_ci -master-bin.000001 406 Query 1 406 use `test`; insert into t2 values (@v) +show binlog events from 95; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 95 User var 1 136 @`a b`=_latin1 0x68656C6C6F COLLATE latin1_swedish_ci +master-bin.000001 136 Query 1 222 use `test`; INSERT INTO t1 VALUES(@`a b`) +master-bin.000001 222 User var 1 264 @`var1`=_latin1 0x273B616161 COLLATE latin1_swedish_ci +master-bin.000001 264 Query 1 350 use `test`; insert into t1 values (@var1) +master-bin.000001 350 Query 1 448 use `test`; create table t2 (c char(30)) charset=ucs2 +master-bin.000001 448 User var 1 488 @`v`=_ucs2 0x006100620063 COLLATE ucs2_general_ci +master-bin.000001 488 Query 1 571 use `test`; insert into t2 values (@v) /*!40019 SET @@session.max_insert_delayed_threads=0*/; SET @`a b`:=_latin1 0x68656C6C6F COLLATE latin1_swedish_ci; use test; SET TIMESTAMP=10000; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; +SET @@session.sql_mode=0; INSERT INTO t1 VALUES(@`a b`); SET @`var1`:=_latin1 0x273B616161 COLLATE latin1_swedish_ci; SET TIMESTAMP=10000; diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result index 461f398c2cc..37e848ad0d9 100644 --- a/mysql-test/r/variables.result +++ b/mysql-test/r/variables.result @@ -364,7 +364,7 @@ set sql_log_bin=1; set sql_log_off=1; set sql_log_update=1; Warnings: -Note 1308 The update log is deprecated and replaced by the binary log; SET SQL_LOG_UPDATE has been ignored +Note 1313 The update log is deprecated and replaced by the binary log; SET SQL_LOG_UPDATE has been ignored set sql_low_priority_updates=1; set sql_max_join_size=200; select @@sql_max_join_size,@@max_join_size; diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test index 5fed85d7f50..07427c616f6 100644 --- a/mysql-test/t/alter_table.test +++ b/mysql-test/t/alter_table.test @@ -110,14 +110,14 @@ drop database mysqltest; # # Rights for renaming test (Bug #3270) # -connect (root,localhost,root,,test,$MASTER_MYPORT,master.sock); +connect (root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK); connection root; --disable_warnings create database mysqltest; --enable_warnings create table mysqltest.t1 (a int,b int,c int); grant all on mysqltest.t1 to mysqltest_1@localhost; -connect (user1,localhost,mysqltest_1,,mysqltest,$MASTER_MYPORT,master.sock); +connect (user1,localhost,mysqltest_1,,mysqltest,$MASTER_MYPORT,$MASTER_MYSOCK); connection user1; -- error 1142 alter table t1 rename t2; diff --git a/mysql-test/t/derived.test b/mysql-test/t/derived.test index fbfd3ccdef1..64e3fe8929b 100644 --- a/mysql-test/t/derived.test +++ b/mysql-test/t/derived.test @@ -101,7 +101,7 @@ SELECT a.x FROM (SELECT 1 AS x) AS a HAVING a.x = 1; # # Connect without a database create table t1 select 1 as a; -connect (con1,localhost,mysqltest_1,,*NO-ONE*,$MASTER_MYPORT,master.sock); +connect (con1,localhost,mysqltest_1,,*NO-ONE*,$MASTER_MYPORT,$MASTER_MYSOCK); connection con1; --error 1046 select 2 as a from (select * from t1) b; diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test index 74f4c1bad44..1416d5f0f9a 100644 --- a/mysql-test/t/func_group.test +++ b/mysql-test/t/func_group.test @@ -220,6 +220,7 @@ insert into t2 values('DEN','Denver','CO','BDL'); insert into t2 values('SDC','San Diego','CA','TWU'); insert into t2 values('NOL','New Orleans','LA','GTM'); insert into t2 values('LAK','Los Angeles','CA','TWU'); +insert into t2 values('AAA','AAA','AA','AME'); # Show the table contents select * from t1; diff --git a/mysql-test/t/grant_cache.test b/mysql-test/t/grant_cache.test index a82cd732802..fc06e04f014 100644 --- a/mysql-test/t/grant_cache.test +++ b/mysql-test/t/grant_cache.test @@ -10,7 +10,7 @@ drop database if exists mysqltest; reset query cache; flush status; -connect (root,localhost,root,,test,$MASTER_MYPORT,master.sock); +connect (root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK); connection root; show grants for current_user; show grants; @@ -25,7 +25,7 @@ insert into mysqltest.t2 values (3,3,3); create table test.t1 (a char (10)); insert into test.t1 values ("test.t1"); select * from t1; -connect (root2,localhost,root,,mysqltest,$MASTER_MYPORT,master.sock); +connect (root2,localhost,root,,mysqltest,$MASTER_MYPORT,$MASTER_MYSOCK); connection root2; # put queries in cache select * from t1; @@ -43,7 +43,7 @@ grant SELECT on test.t1 to mysqltest_2@localhost; grant SELECT(a) on mysqltest.t1 to mysqltest_3@localhost; # The following queries should be fetched from cache -connect (user1,localhost,mysqltest_1,,mysqltest,$MASTER_MYPORT,master.sock); +connect (user1,localhost,mysqltest_1,,mysqltest,$MASTER_MYPORT,$MASTER_MYSOCK); connection user1; show grants for current_user(); show status like "Qcache_queries_in_cache"; @@ -67,12 +67,12 @@ show status like "Qcache_queries_in_cache"; show status like "Qcache_hits"; show status like "Qcache_not_cached"; -connect (unkuser,localhost,,,,$MASTER_MYPORT,master.sock); +connect (unkuser,localhost,,,,$MASTER_MYPORT,$MASTER_MYSOCK); connection unkuser; show grants for current_user(); # The following queries should be fetched from cache -connect (user2,localhost,mysqltest_2,,mysqltest,$MASTER_MYPORT,master.sock); +connect (user2,localhost,mysqltest_2,,mysqltest,$MASTER_MYPORT,$MASTER_MYSOCK); connection user2; select "user2"; select * from t1; @@ -87,7 +87,7 @@ show status like "Qcache_hits"; show status like "Qcache_not_cached"; # The following queries should not be fetched from cache -connect (user3,localhost,mysqltest_3,,mysqltest,$MASTER_MYPORT,master.sock); +connect (user3,localhost,mysqltest_3,,mysqltest,$MASTER_MYPORT,$MASTER_MYSOCK); connection user3; select "user3"; --replace_result 127.0.0.1 localhost @@ -108,7 +108,7 @@ show status like "Qcache_hits"; show status like "Qcache_not_cached"; # Connect without a database -connect (user4,localhost,mysqltest_1,,*NO-ONE*,$MASTER_MYPORT,master.sock); +connect (user4,localhost,mysqltest_1,,*NO-ONE*,$MASTER_MYPORT,$MASTER_MYSOCK); connection user4; select "user4"; show grants; diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test index 56f01f2ae92..d28619f0313 100644 --- a/mysql-test/t/multi_update.test +++ b/mysql-test/t/multi_update.test @@ -388,7 +388,7 @@ drop table t1, t2; # prevelege chexk for multiupdate with other tables # -connect (root,localhost,root,,test,$MASTER_MYPORT,master.sock); +connect (root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK); connection root; --disable_warnings create database mysqltest; @@ -398,7 +398,7 @@ create table mysqltest.t2 (a int, b int, primary key (a)); create table mysqltest.t3 (a int, b int, primary key (a)); grant select on mysqltest.* to mysqltest_1@localhost; grant update on mysqltest.t1 to mysqltest_1@localhost; -connect (user1,localhost,mysqltest_1,,mysqltest,$MASTER_MYPORT,master.sock); +connect (user1,localhost,mysqltest_1,,mysqltest,$MASTER_MYPORT,$MASTER_MYSOCK); connection user1; update t1, t2 set t1.b=1 where t1.a=t2.a; update t1, t2 set t1.b=(select t3.b from t3 where t1.a=t3.a) where t1.a=t2.a; diff --git a/mysql-test/t/rpl000015.test b/mysql-test/t/rpl000015.test index 60262fdf59c..da73c5f4db2 100644 --- a/mysql-test/t/rpl000015.test +++ b/mysql-test/t/rpl000015.test @@ -1,4 +1,4 @@ -connect (master,localhost,root,,test,$MASTER_MYPORT,master.sock); +connect (master,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK); connect (slave,localhost,root,,test,$SLAVE_MYPORT,slave.sock); connection master; reset master; diff --git a/mysql-test/t/rpl000017.test b/mysql-test/t/rpl000017.test index cf808a2cbc0..3b39a6b49a6 100644 --- a/mysql-test/t/rpl000017.test +++ b/mysql-test/t/rpl000017.test @@ -1,4 +1,4 @@ -connect (master,localhost,root,,test,$MASTER_MYPORT,master.sock); +connect (master,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK); connect (slave,localhost,root,,test,$SLAVE_MYPORT,slave.sock); connection master; reset master; diff --git a/mysql-test/t/rpl000018.test b/mysql-test/t/rpl000018.test index 884ec9727d2..fd2be2399a5 100644 --- a/mysql-test/t/rpl000018.test +++ b/mysql-test/t/rpl000018.test @@ -4,7 +4,7 @@ # require_manager; -connect (master,localhost,root,,test,0,master.sock); +connect (master,localhost,root,,test,0,$MASTER_MYPORT); connect (slave,localhost,root,,test,0,slave.sock); connection master; reset master; diff --git a/mysql-test/t/rpl_charset.test b/mysql-test/t/rpl_charset.test index 02bcdf1f5f1..3dc219fef86 100644 --- a/mysql-test/t/rpl_charset.test +++ b/mysql-test/t/rpl_charset.test @@ -106,7 +106,7 @@ select * from test2.t1 order by a; connection master; drop database test2; drop database test3; -show binlog events from 79; +show binlog events from 95; sync_slave_with_master; # Check that we can't change global.collation_server diff --git a/mysql-test/t/rpl_heap.test b/mysql-test/t/rpl_heap.test index 15f61918034..f122b5ab2a1 100644 --- a/mysql-test/t/rpl_heap.test +++ b/mysql-test/t/rpl_heap.test @@ -7,7 +7,7 @@ require_manager; # issue a query after the server restart. # Maybe this is something awkward in mysqltest or in the manager? # So we use sockets. -connect (master,localhost,root,,test,0,master.sock); +connect (master,localhost,root,,test,0,$MASTER_MYPORT); connect (slave,localhost,root,,test,0,slave.sock); connection master; diff --git a/mysql-test/t/rpl_rotate_logs.test b/mysql-test/t/rpl_rotate_logs.test index fe0d1de5809..c3c0ff5be10 100644 --- a/mysql-test/t/rpl_rotate_logs.test +++ b/mysql-test/t/rpl_rotate_logs.test @@ -9,7 +9,7 @@ # changes # - Test creating a duplicate key error and recover from it -connect (master,localhost,root,,test,$MASTER_MYPORT,master.sock); +connect (master,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK); --disable_warnings drop table if exists t1, t2, t3, t4; --enable_warnings diff --git a/mysql-test/t/sp-error.test b/mysql-test/t/sp-error.test index 785c2aafa85..5a139e14560 100644 --- a/mysql-test/t/sp-error.test +++ b/mysql-test/t/sp-error.test @@ -49,18 +49,18 @@ create function func1() returns int return 42| # Can't create recursively ---error 1296 +--error 1301 create procedure foo() create procedure bar() set @x=3| ---error 1296 +--error 1301 create procedure foo() create function bar() returns double return 2.3| # Already exists ---error 1297 +--error 1302 create procedure proc1() set @x = 42| ---error 1297 +--error 1302 create function func1() returns int return 42| @@ -68,39 +68,39 @@ drop procedure proc1| drop function func1| # Does not exist ---error 1298 +--error 1303 alter procedure foo| ---error 1298 +--error 1303 alter function foo| ---error 1298 +--error 1303 drop procedure foo| ---error 1298 +--error 1303 drop function foo| ---error 1298 +--error 1303 call foo()| drop procedure if exists foo| ---error 1298 +--error 1303 show create procedure foo| # LEAVE/ITERATE with no match ---error 1301 +--error 1306 create procedure foo() foo: loop leave bar; end loop| ---error 1301 +--error 1306 create procedure foo() foo: loop iterate bar; end loop| ---error 1301 +--error 1306 create procedure foo() foo: begin iterate foo; end| # Redefining label ---error 1302 +--error 1307 create procedure foo() foo: loop foo: loop @@ -109,7 +109,7 @@ foo: loop end loop foo| # End label mismatch ---error 1303 +--error 1308 create procedure foo() foo: loop set @x=2; @@ -124,12 +124,12 @@ end| drop procedure foo| # RETURN in FUNCTION only ---error 1306 +--error 1311 create procedure foo() return 42| # Doesn't allow queries in FUNCTIONs (for now :-( ) ---error 1307 +--error 1312 create function foo() returns int begin declare x int; @@ -143,19 +143,19 @@ create procedure p(x int) create function f(x int) returns int return x+42| ---error 1311 +--error 1316 call p()| ---error 1311 +--error 1316 call p(1, 2)| ---error 1311 +--error 1316 select f()| ---error 1311 +--error 1316 select f(1, 2)| drop procedure p| drop function f| ---error 1312 +--error 1317 create procedure p(val int, out res int) begin declare x int default 0; @@ -169,7 +169,7 @@ begin end if; end| ---error 1312 +--error 1317 create procedure p(val int, out res int) begin declare x int default 0; @@ -184,7 +184,7 @@ begin end if; end| ---error 1313 +--error 1318 create function f(val int) returns int begin declare x int; @@ -202,12 +202,12 @@ begin end if; end| ---error 1314 +--error 1319 select f(10)| drop function f| ---error 1315 +--error 1320 create procedure p() begin declare c cursor for insert into test.t1 values ("foo", 42); @@ -216,7 +216,7 @@ begin close c; end| ---error 1316 +--error 1321 create procedure p() begin declare x int; @@ -226,7 +226,7 @@ begin close c; end| ---error 1317 +--error 1322 create procedure p() begin declare c cursor for select * from test.t; @@ -248,7 +248,7 @@ begin open c; close c; end| ---error 1318 +--error 1323 call p()| drop procedure p| @@ -260,11 +260,11 @@ begin close c; close c; end| ---error 1319 +--error 1324 call p()| drop procedure p| ---error 1298 +--error 1303 alter procedure bar3 sql security invoker| --error 1059 alter procedure bar3 name @@ -278,7 +278,7 @@ drop table if exists t1| create table t1 (val int, x float)| insert into t1 values (42, 3.1), (19, 1.2)| ---error 1320 +--error 1325 create procedure p() begin declare x int; @@ -298,7 +298,7 @@ begin fetch c into x; close c; end| ---error 1321 +--error 1326 call p()| drop procedure p| @@ -313,34 +313,34 @@ begin fetch c into x, y, z; close c; end| ---error 1321 +--error 1326 call p()| drop procedure p| ---error 1323 +--error 1328 create procedure p(in x int, x char(10)) begin end| ---error 1323 +--error 1328 create function p(x int, x char(10)) begin end| ---error 1324 +--error 1329 create procedure p() begin declare x float; declare x int; end| ---error 1325 +--error 1330 create procedure p() begin declare c condition for 1064; declare c condition for 1065; end| ---error 1326 +--error 1331 create procedure p() begin declare c cursor for select * from t1; @@ -348,18 +348,18 @@ begin end| # USE is not allowed ---error 1329 +--error 1334 create procedure u() use sptmp| # Enforced standard order of declarations ---error 1330 +--error 1335 create procedure p() begin declare c cursor for select * from t1; declare x int; end| ---error 1330 +--error 1335 create procedure p() begin declare x int; @@ -367,7 +367,7 @@ begin declare foo condition for sqlstate '42S99'; end| ---error 1331 +--error 1336 create procedure p() begin declare x int; @@ -392,13 +392,13 @@ drop procedure bug1965| # # BUG#1966 # ---error 1320 +--error 1325 select 1 into a| # # BUG#336 # ---error 1328 +--error 1333 create procedure bug336(id char(16)) begin declare x int; @@ -408,7 +408,7 @@ end| # # BUG#1654 # ---error 1307 +--error 1312 create function bug1654() returns int return (select sum(t.data) from test.t2 t)| @@ -446,7 +446,7 @@ begin fetch c1 into v1; end| ---error 1319 +--error 1324 call bug2259()| drop procedure bug2259| @@ -502,7 +502,7 @@ begin end case; return 2; end| ---error 1332 +--error 1337 select bug3287()| drop function bug3287| @@ -513,7 +513,7 @@ when 0 then when 1 then insert into test.t1 values (x, 1.1); end case| ---error 1332 +--error 1337 call bug3287(2)| drop procedure bug3287| diff --git a/mysql-test/t/sp-security.test b/mysql-test/t/sp-security.test index 046a9018472..b7d183e64c5 100644 --- a/mysql-test/t/sp-security.test +++ b/mysql-test/t/sp-security.test @@ -60,7 +60,7 @@ select * from db1_secret.t1; # ...and not this --error 1049 create procedure db1_secret.dummy() begin end; ---error 1298 +--error 1303 drop procedure db1_secret.dummy; @@ -80,7 +80,7 @@ select * from db1_secret.t1; # ...and not this --error 1049 create procedure db1_secret.dummy() begin end; ---error 1298 +--error 1303 drop procedure db1_secret.dummy; diff --git a/mysql-test/t/user_var.test b/mysql-test/t/user_var.test index 601724e68c8..412003aa547 100644 --- a/mysql-test/t/user_var.test +++ b/mysql-test/t/user_var.test @@ -111,7 +111,7 @@ insert into t1 values (@var1); create table t2 (c char(30)) charset=ucs2; set @v=convert('abc' using ucs2); insert into t2 values (@v); -show binlog events from 79; +show binlog events from 95; # more important than SHOW BINLOG EVENTS, mysqlbinlog (where we # absolutely need variables names to be quoted and strings to be # escaped). diff --git a/scripts/mysql_fix_privilege_tables.sh b/scripts/mysql_fix_privilege_tables.sh index 79b4bc627b7..6a0618fc1b5 100644 --- a/scripts/mysql_fix_privilege_tables.sh +++ b/scripts/mysql_fix_privilege_tables.sh @@ -7,13 +7,14 @@ password="" host="localhost" user="root" sql_only=0 -basedir="" +basedir="@prefix@" verbose=0 args="" port="" socket="" database="mysql" bindir="" +pkgdatadir="@pkgdatadir@" file=mysql_fix_privilege_tables.sql @@ -85,34 +86,23 @@ done parse_arguments `$print_defaults $defaults mysql_install_db mysql_fix_privilege_tables` parse_arguments PICK-ARGS-FROM-ARGV "$@" -if test -z "$basedir" +if test -z "$password" then - basedir=@prefix@ - if test -z "$bindir" - then - bindir=@bindir@ - fi - execdir=@libexecdir@ - pkgdatadir=@pkgdatadir@ -else - if test -z "$bindir" - then - bindir="$basedir/bin" - fi - if test -x "$basedir/libexec/mysqld" - then - execdir="$basedir/libexec" - elif test -x "@libexecdir@/mysqld" - then - execdir="@libexecdir@" - else - execdir="$basedir/bin" - fi + password=$old_style_password fi -if test -z "$password" +# Find where 'mysql' command is located + +if test -z "$bindir" then - password=$old_style_password + for i in @bindir@ $basedir/bin client + do + if test -f $i/mysql + then + bindir=$i + break + fi + done fi cmd="$bindir/mysql -f --user=$user --host=$host" @@ -134,7 +124,7 @@ fi # Find where first mysql_fix_privilege_tables.sql is located for i in $basedir/support-files $basedir/share $basedir/share/mysql \ - $basedir/scripts @pkgdatadir@ . ./scripts + $basedir/scripts $pkgdatadir . ./scripts do if test -f $i/$file then @@ -163,7 +153,8 @@ s_echo "This scripts updates all the mysql privilege tables to be usable by" s_echo "MySQL 4.0 and above." s_echo "" s_echo "This is needed if you want to use the new GRANT functions," -s_echo "CREATE AGGREGATE FUNCTION or want to use the more secure passwords in 4.1" +s_echo "CREATE AGGREGATE FUNCTION, use stored procedures or want to use the" +s_echo "more secure passwords in 4.1" s_echo "" if test $verbose = 1 diff --git a/sql/handler.cc b/sql/handler.cc index 017b9d9d4c8..8ca842efebe 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -1493,4 +1493,3 @@ int handler::index_read_idx(byte * buf, uint index, const byte * key, error= ha_index_end(); return error; } - diff --git a/sql/handler.h b/sql/handler.h index 2cc0858f26c..6502ed8f3e9 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -306,29 +306,33 @@ public: int ha_index_init(uint idx) { + DBUG_ENTER("ha_index_init"); DBUG_ASSERT(inited==NONE); inited=INDEX; - return index_init(idx); + DBUG_RETURN(index_init(idx)); } int ha_index_end() { + DBUG_ENTER("ha_index_end"); DBUG_ASSERT(inited==INDEX); inited=NONE; - return index_end(); + DBUG_RETURN(index_end()); } int ha_rnd_init(bool scan) { + DBUG_ENTER("ha_rnd_init"); DBUG_ASSERT(inited==NONE || (inited==RND && scan)); inited=RND; - return rnd_init(scan); + DBUG_RETURN(rnd_init(scan)); } int ha_rnd_end() { + DBUG_ENTER("ha_rnd_end"); DBUG_ASSERT(inited==RND); inited=NONE; - return rnd_end(); + DBUG_RETURN(rnd_end()); } - /* this is neseccary in many places, e.g. in HANDLER command */ + /* this is necessary in many places, e.g. in HANDLER command */ int ha_index_or_rnd_end() { return inited == INDEX ? ha_index_end() : inited == RND ? ha_rnd_end() : 0; diff --git a/sql/item.h b/sql/item.h index a169fc32a0b..3a2cb4bf3f7 100644 --- a/sql/item.h +++ b/sql/item.h @@ -131,7 +131,10 @@ public: optimisation changes in prepared statements */ Item(THD *thd, Item *item); - virtual ~Item() { name=0; } /*lint -e1509 */ + virtual ~Item() + { + name=0; + } /*lint -e1509 */ void set_name(const char *str,uint length, CHARSET_INFO *cs); void init_make_field(Send_field *tmp_field,enum enum_field_types type); virtual void cleanup() diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 60f80249e94..976cd07cdbe 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -486,10 +486,8 @@ bool Item_in_optimizer::fix_left(THD *thd, /* If it is preparation PS only then we do not know values of parameters => cant't get there values and do not need that values. - - TODO: during merge with 5.0 it should be changed on !thd->only_prepare() */ - if (!thd->current_statement) + if (!thd->only_prepare()) cache->store(args[0]); if (cache->cols() == 1) { diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 68360f91191..a144570a405 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -726,19 +726,30 @@ QUICK_RANGE_SELECT::QUICK_RANGE_SELECT(THD *thd, TABLE *table, uint key_nr, record= head->record[0]; } + int QUICK_RANGE_SELECT::init() { DBUG_ENTER("QUICK_RANGE_SELECT::init"); - DBUG_RETURN(error= file->ha_index_init(index)); + if (file->inited == handler::NONE) + DBUG_RETURN(error= file->ha_index_init(index)); + error= 0; + DBUG_RETURN(0); } + +void QUICK_RANGE_SELECT::range_end() +{ + if (file->inited != handler::NONE) + file->ha_index_end(); +} + + QUICK_RANGE_SELECT::~QUICK_RANGE_SELECT() { DBUG_ENTER("QUICK_RANGE_SELECT::~QUICK_RANGE_SELECT"); if (!dont_free) { - if (file->inited) - file->ha_index_end(); + range_end(); file->extra(HA_EXTRA_NO_KEYREAD); delete_dynamic(&ranges); /* ranges are allocated in alloc */ if (free_file) @@ -879,8 +890,7 @@ int QUICK_RANGE_SELECT::init_ror_merged_scan(bool reuse_handler) { DBUG_RETURN(1); } - else - DBUG_RETURN(0); + DBUG_RETURN(0); } /* Create a separate handler object for this quick select */ @@ -974,10 +984,8 @@ int QUICK_ROR_INTERSECT_SELECT::init_ror_merged_scan(bool reuse_handler) int QUICK_ROR_INTERSECT_SELECT::reset() { - int result; DBUG_ENTER("QUICK_ROR_INTERSECT_SELECT::reset"); - result= init_ror_merged_scan(TRUE); - DBUG_RETURN(result); + DBUG_RETURN(init_ror_merged_scan(TRUE)); } @@ -1008,12 +1016,15 @@ QUICK_ROR_INTERSECT_SELECT::~QUICK_ROR_INTERSECT_SELECT() quick_selects.delete_elements(); delete cpk_quick; free_root(&alloc,MYF(0)); + if (need_to_fetch_row && head->file->inited != handler::NONE) + head->file->ha_rnd_end(); DBUG_VOID_RETURN; } + QUICK_ROR_UNION_SELECT::QUICK_ROR_UNION_SELECT(THD *thd_param, TABLE *table) - : thd(thd_param) + :thd(thd_param) { index= MAX_KEY; head= table; @@ -1098,8 +1109,7 @@ int QUICK_ROR_UNION_SELECT::reset() { if (error == HA_ERR_END_OF_FILE) continue; - else - DBUG_RETURN(error); + DBUG_RETURN(error); } quick->save_last_pos(); queue_insert(&queue, (byte*)quick); @@ -2970,7 +2980,7 @@ static TRP_RANGE *get_key_scans_params(PARAM *param, SEL_TREE *tree, } if (found_records != HA_POS_ERROR && found_records > 2 && read_index_only && - (param->table->file->index_flags(keynr, param.max_key_part,1) & + (param->table->file->index_flags(keynr, param->max_key_part,1) & HA_KEYREAD_ONLY) && !(pk_is_clustered && keynr == param->table->primary_key)) { @@ -5349,10 +5359,11 @@ int QUICK_INDEX_MERGE_SELECT::prepare_unique() thd->variables.sortbuff_size); if (!unique) DBUG_RETURN(1); - do + for (;;) { while ((result= cur_quick_select->get_next()) == HA_ERR_END_OF_FILE) { + cur_quick_select->range_end(); cur_quick_select= cur_quick_it++; if (!cur_quick_select) break; @@ -5383,12 +5394,13 @@ int QUICK_INDEX_MERGE_SELECT::prepare_unique() if (result) DBUG_RETURN(1); - }while(TRUE); + } /* ok, all row ids are in Unique */ result= unique->get(head); doing_pk_scan= FALSE; - init_read_record(&read_record, thd, head, NULL, 1, 1); + /* start table scan */ + init_read_record(&read_record, thd, head, (SQL_SELECT*) 0, 1, 1); /* index_merge currently doesn't support "using index" at all */ head->file->extra(HA_EXTRA_NO_KEYREAD); @@ -5420,7 +5432,7 @@ int QUICK_INDEX_MERGE_SELECT::get_next() result= HA_ERR_END_OF_FILE; end_read_record(&read_record); /* All rows from Unique have been retrieved, do a clustered PK scan */ - if(pk_quick_select) + if (pk_quick_select) { doing_pk_scan= TRUE; if ((result= pk_quick_select->init())) diff --git a/sql/opt_range.h b/sql/opt_range.h index 122d444af31..3082e2d8a69 100644 --- a/sql/opt_range.h +++ b/sql/opt_range.h @@ -133,6 +133,9 @@ public: other Error code */ virtual int reset(void) = 0; + + /* Range end should be called when we have looped over the whole index */ + virtual void range_end() {} virtual int get_next() = 0; /* get next record to retrieve */ virtual bool reverse_sorted() = 0; virtual bool unique_key_range() { return false; } @@ -273,6 +276,8 @@ public: } int init(); int get_next(); + void range_end(); + bool reverse_sorted() { return 0; } bool unique_key_range(); int init_ror_merged_scan(bool reuse_handler); diff --git a/sql/sp.cc b/sql/sp.cc index 8835070bd9f..9ae7e6bef9e 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -606,6 +606,7 @@ db_show_routine_status(THD *thd, int type, const char *wild) err_case1: send_eof(thd); err_case: + table->file->ha_index_end(); close_thread_tables(thd); done: DBUG_RETURN(res); @@ -670,6 +671,7 @@ sp_drop_db_routines(THD *thd, char *db) if (deleted) sp_cache_invalidate(); } + table->file->ha_index_end(); close_thread_tables(thd); diff --git a/sql/sp_head.cc b/sql/sp_head.cc index 7f4f2351625..d4ba43cef20 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -485,9 +485,14 @@ sp_head::execute_function(THD *thd, Item **argp, uint argcount, Item **resp) nctx->push_item(sp_eval_func_item(thd, *argp++, pvar->type)); } - // Close tables opened for subselect in argument list +#ifdef NOT_WORKING + /* + Close tables opened for subselect in argument list + This can't be done as this will close all other tables used + by the query. + */ close_thread_tables(thd); - +#endif // The rest of the frame are local variables which are all IN. // Default all variables to null (those with default clauses will // be set by an set instruction). diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 22f93bb05ba..954cf7a5a6d 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -363,6 +363,7 @@ bool close_cached_tables(THD *thd, bool if_wait_for_refresh, void close_thread_tables(THD *thd, bool lock_in_use, bool skip_derived) { + bool found_old_table=0; DBUG_ENTER("close_thread_tables"); if (thd->derived_tables && !skip_derived) @@ -385,8 +386,6 @@ void close_thread_tables(THD *thd, bool lock_in_use, bool skip_derived) DBUG_VOID_RETURN; // LOCK TABLES in use } - bool found_old_table=0; - if (thd->lock) { mysql_unlock_tables(thd, thd->lock); @@ -397,7 +396,7 @@ void close_thread_tables(THD *thd, bool lock_in_use, bool skip_derived) VOID(pthread_mutex_lock(&LOCK_open)); safe_mutex_assert_owner(&LOCK_open); - DBUG_PRINT("info", ("thd->open_tables=%p", thd->open_tables)); + DBUG_PRINT("info", ("thd->open_tables: %p", thd->open_tables)); while (thd->open_tables) found_old_table|=close_thread_table(thd, &thd->open_tables); @@ -427,6 +426,7 @@ bool close_thread_table(THD *thd, TABLE **table_ptr) bool found_old_table= 0; TABLE *table= *table_ptr; DBUG_ASSERT(table->key_read == 0); + DBUG_ASSERT(table->file->inited == handler::NONE); *table_ptr=table->next; if (table->version != refresh_version || diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc index 56c1b0a1b51..538ca3fd1f0 100644 --- a/sql/sql_handler.cc +++ b/sql/sql_handler.cc @@ -194,13 +194,14 @@ int mysql_ha_close_list(THD *thd, TABLE_LIST *tables, bool flushed) } static enum enum_ha_read_modes rkey_to_rnext[]= - { RNEXT_SAME, RNEXT, RPREV, RNEXT, RPREV, RNEXT, RPREV, RPREV }; +{ RNEXT_SAME, RNEXT, RPREV, RNEXT, RPREV, RNEXT, RPREV, RPREV }; int mysql_ha_read(THD *thd, TABLE_LIST *tables, - enum enum_ha_read_modes mode, char *keyname, List<Item> *key_expr, - enum ha_rkey_function ha_rkey_mode, Item *cond, - ha_rows select_limit,ha_rows offset_limit) + enum enum_ha_read_modes mode, char *keyname, + List<Item> *key_expr, + enum ha_rkey_function ha_rkey_mode, Item *cond, + ha_rows select_limit,ha_rows offset_limit) { int err, keyno=-1; bool was_flushed; @@ -227,7 +228,7 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables, if ((keyno=find_type(keyname, &table->keynames, 1+2)-1)<0) { my_printf_error(ER_KEY_DOES_NOT_EXITS,ER(ER_KEY_DOES_NOT_EXITS),MYF(0), - keyname,tables->alias); + keyname,tables->alias); return -1; } table->file->ha_index_or_rnd_end(); @@ -257,7 +258,7 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables, MYSQL_LOCK *lock=mysql_lock_tables(thd,&tables->table,1); HANDLER_TABLES_HACK(thd); if (!lock) - goto err0; // mysql_lock_tables() printed error message already + goto err0; // mysql_lock_tables() printed error message already /* In ::external_lock InnoDB resets the fields which tell it that @@ -290,7 +291,7 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables, err=keyname ? table->file->index_next(table->record[0]) : table->file->rnd_next(table->record[0]); - break; + break; case RPREV: DBUG_ASSERT(keyname != 0); err=table->file->index_prev(table->record[0]); @@ -442,6 +443,8 @@ static TABLE **find_table_ptr_by_name(THD *thd, const char *db, { if (!dont_lock) VOID(pthread_mutex_lock(&LOCK_open)); + + table->file->ha_index_or_rnd_end(); if (close_thread_table(thd, table_ptr)) { /* Tell threads waiting for refresh that something has happened */ diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 3eea8ae30d3..34a668472e2 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1158,8 +1158,10 @@ end: void free_items(Item *item) { + DBUG_ENTER("free_items"); for (; item ; item=item->next) item->delete_self(); + DBUG_VOID_RETURN; } /* This works because items are allocated with sql_alloc() */ @@ -4380,16 +4382,17 @@ bool mysql_test_parse_for_slave(THD *thd, char *inBuf, uint length) { LEX *lex; bool error= 0; + DBUG_ENTER("mysql_test_parse_for_slave"); mysql_init_query(thd); lex= lex_start(thd, (uchar*) inBuf, length); if (!yyparse((void*) thd) && ! thd->is_fatal_error && all_tables_not_ok(thd,(TABLE_LIST*) lex->select_lex.table_list.first)) - error= 1; /* Ignore question */ + error= 1; /* Ignore question */ free_items(thd->free_list); /* Free strings used by items */ lex_end(lex); - return error; + DBUG_RETURN(error); } #endif diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index eeaa40f1a75..23c5a302190 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -1647,10 +1647,17 @@ int mysql_stmt_prepare(THD *thd, char *packet, uint packet_length, /* error is sent inside yyparse/send_prepare_results */ } else - stmt->setup_set_params(); - + { + stmt->setup_set_params(); + SELECT_LEX *sl= stmt->lex->all_selects_list; + /* + Save WHERE clause pointers, because they may be changed during query + optimisation. + */ + for (; sl; sl= sl->next_select_in_list()) + sl->prep_where= sl->where; + } DBUG_RETURN(!stmt); - } /* Reinit statement before execution */ @@ -1839,7 +1846,9 @@ void mysql_sql_stmt_execute(THD *thd, LEX_STRING *stmt_name) my_error(ER_WRONG_ARGUMENTS, MYF(0), "EXECUTE"); send_error(thd); } + thd->current_arena= stmt; execute_stmt(thd, stmt, &expanded_query, false); + thd->current_arena= 0; DBUG_VOID_RETURN; } @@ -1885,12 +1894,13 @@ static void execute_stmt(THD *thd, Prepared_statement *stmt, if (!(specialflag & SPECIAL_NO_PRIOR)) my_pthread_setprio(pthread_self(), WAIT_PRIOR); - /* Free Items that were created during this execution of the PS. */ - free_items(thd->free_list); cleanup_items(stmt->free_list); reset_stmt_params(stmt); close_thread_tables(thd); // to close derived tables thd->set_statement(&thd->stmt_backup); + /* Free Items that were created during this execution of the PS. */ + free_items(thd->free_list); + thd->free_list= 0; DBUG_VOID_RETURN; } diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 974012093e3..cada2d34948 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -2874,7 +2874,7 @@ best_access_path(JOIN *join, Set tmp to (previous record count) * (records / combination) */ if ((found_part & 1) && - (!(table->file->index_flags(key) & HA_ONLY_WHOLE_INDEX) || + (!(table->file->index_flags(key, 0, 0) & HA_ONLY_WHOLE_INDEX) || found_part == PREV_BITS(uint,keyinfo->key_parts))) { max_key_part=max_part_bit(found_part); @@ -5107,7 +5107,7 @@ JOIN::join_free(bool full) if (full) { group_fields.delete_elements(); - tmp_table_param.copy_funcs.delete_elements(); + tmp_table_param.copy_funcs.empty(); tmp_table_param.cleanup(); } DBUG_VOID_RETURN; @@ -5575,8 +5575,10 @@ propagate_cond_constants(I_List<COND_CMP> *save_list,COND *and_father, COND *eliminate_not_funcs(THD *thd, COND *cond) { + DBUG_ENTER("eliminate_not_funcs"); + if (!cond) - return cond; + DBUG_RETURN(cond); if (cond->type() == Item::COND_ITEM) /* OR or AND */ { List_iterator<Item> li(*((Item_cond*) cond)->argument_list()); @@ -5601,7 +5603,7 @@ COND *eliminate_not_funcs(THD *thd, COND *cond) cond= new_cond; } } - return cond; + DBUG_RETURN(cond); } @@ -5838,8 +5840,7 @@ optimize_cond(JOIN *join, COND *conds, Item::cond_result *cond_value) SELECT_LEX *select= thd->lex->current_select; if (select->first_cond_optimization) { - Item_arena *arena= select->first_cond_optimization ? - thd->current_arena : 0; + Item_arena *arena= thd->current_arena; Item_arena backup; if (arena) thd->set_n_backup_item_arena(arena, &backup); @@ -8865,6 +8866,7 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit, */ if (!select->quick->reverse_sorted()) { + int quick_type= select->quick->get_type(); /* here used_key_parts >0 */ if (!(table->file->index_flags(ref_key,used_key_parts-1, 1) & HA_READ_PREV) || |