Commit c883cc86 authored by Narayanan V's avatar Narayanan V

merging with mysql-5.1-bugteam tree

parents 1a5751ba 5d5f0fcd
...@@ -9,6 +9,3 @@ select user(); ...@@ -9,6 +9,3 @@ select user();
user() user()
# #
show processlist; show processlist;
Id User Host db Command Time State Info
<id> root <host> test <command> <time> <state> <info>
<id> root <host> test <command> <time> <state> <info>
...@@ -1389,3 +1389,8 @@ SET @@session.thread_stack= 7; ...@@ -1389,3 +1389,8 @@ SET @@session.thread_stack= 7;
ERROR HY000: Variable 'thread_stack' is a read only variable ERROR HY000: Variable 'thread_stack' is a read only variable
SET @@global.thread_stack= 7; SET @@global.thread_stack= 7;
ERROR HY000: Variable 'thread_stack' is a read only variable ERROR HY000: Variable 'thread_stack' is a read only variable
select @@storage_engine;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def @@storage_engine 253 6 6 N 1 31 8
@@storage_engine
MyISAM
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
SET @old_sql_mode= @@global.sql_mode;
SET @old_binlog_format=@@session.binlog_format;
SET SESSION sql_mode=8;
Initialization
RESET MASTER;
CREATE TABLE t1 (id INT);
CREATE PROCEDURE testProc() SELECT * FROM t1;
CREATE VIEW testView as SELECT * from t1;
CREATE FUNCTION testFunc()
RETURNS INT
BEGIN
return 1;
END;|
CREATE TRIGGER testTrig BEFORE INSERT ON t1
FOR EACH ROW BEGIN
UPDATE t1 SET id = id +1;
END;|
CREATE EVENT testEvent ON SCHEDULE
EVERY 1 DAY
DO
BEGIN
UPDATE t1 SET id = id +1;
END;|
Chceck Result
select
(@a:=load_file("MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug39526.binlog"))
is not null;
(@a:=load_file("MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug39526.binlog"))
is not null
1
*** String sql_mode=0 is found: 0 ***
Clean Up
DROP PROCEDURE testProc;
DROP FUNCTION testFunc;
DROP TRIGGER testTrig;
DROP EVENT testEvent;
DROP VIEW testView;
DROP TABLE t1;
SET @@global.sql_mode= @old_sql_mode;
SET @@session.binlog_format=@old_binlog_format;
...@@ -227,3 +227,86 @@ UPDATE t1 SET b = '%s%s%s%s%s%s%s%s%s%s%s%s%s%s' WHERE a = 'a' LIMIT 1; ...@@ -227,3 +227,86 @@ UPDATE t1 SET b = '%s%s%s%s%s%s%s%s%s%s%s%s%s%s' WHERE a = 'a' LIMIT 1;
Warnings: Warnings:
Warning 1592 Statement is not safe to log in statement format. Warning 1592 Statement is not safe to log in statement format.
DROP TABLE t1; DROP TABLE t1;
DROP TABLE IF EXISTS t1, t2;
CREATE TABLE t1(i INT PRIMARY KEY);
CREATE TABLE t2(i INT PRIMARY KEY);
CREATE TABLE t3(i INT, ch CHAR(50));
"Should issue message Statement is not safe to log in statement format."
INSERT INTO t1 SELECT * FROM t2 LIMIT 1;
Warnings:
Warning 1592 Statement is not safe to log in statement format.
CREATE FUNCTION func6()
RETURNS INT
BEGIN
INSERT INTO t1 VALUES (10);
INSERT INTO t1 VALUES (11);
INSERT INTO t1 VALUES (12);
RETURN 0;
END|
"Should issue message Statement is not safe to log in statement format only once"
INSERT INTO t3 VALUES(func6(), UUID());
Warnings:
Warning 1592 Statement is not safe to log in statement format.
"Check whether SET @@SQL_LOG_BIN = 0/1 doesn't work in substatements"
CREATE FUNCTION fun_check_log_bin() RETURNS INT
BEGIN
SET @@SQL_LOG_BIN = 0;
INSERT INTO t1 VALUES(@@global.sync_binlog);
RETURN 100;
END|
"One unsafe warning should be issued in the following statement"
SELECT fun_check_log_bin();
fun_check_log_bin()
100
Warnings:
Warning 1592 Statement is not safe to log in statement format.
"SQL_LOG_BIN should be ON still"
SHOW VARIABLES LIKE "SQL_LOG_BIN";
Variable_name Value
sql_log_bin ON
set @save_log_bin = @@SESSION.SQL_LOG_BIN;
set @@SESSION.SQL_LOG_BIN = 0;
"Should NOT have any warning message issued in the following statements"
INSERT INTO t1 SELECT * FROM t2 LIMIT 1;
DROP TABLE t1,t2;
"Should NOT have any warning message issued in the following func7() and trig"
CREATE TABLE t1 (a INT);
CREATE TABLE t2 (a CHAR(40));
CREATE TABLE trigger_table (a CHAR(7));
CREATE FUNCTION func7()
RETURNS INT
BEGIN
INSERT INTO t1 VALUES (@@global.sync_binlog);
INSERT INTO t1 VALUES (@@session.insert_id);
INSERT INTO t2 SELECT UUID();
INSERT INTO t2 VALUES (@@session.sql_mode);
INSERT INTO t2 VALUES (@@global.init_slave);
RETURN 0;
END|
SHOW VARIABLES LIKE "SQL_LOG_BIN";
Variable_name Value
sql_log_bin OFF
SELECT func7();
func7()
0
---- Insert from trigger ----
CREATE TRIGGER trig
BEFORE INSERT ON trigger_table
FOR EACH ROW
BEGIN
INSERT INTO t1 VALUES (@@global.sync_binlog);
INSERT INTO t1 VALUES (@@session.insert_id);
INSERT INTO t1 VALUES (@@global.auto_increment_increment);
INSERT INTO t2 SELECT UUID();
INSERT INTO t2 VALUES (@@session.sql_mode);
INSERT INTO t2 VALUES (@@global.init_slave);
INSERT INTO t2 VALUES (@@hostname);
END|
INSERT INTO trigger_table VALUES ('bye.');
DROP FUNCTION fun_check_log_bin;
DROP FUNCTION func6;
DROP FUNCTION func7;
DROP TRIGGER trig;
DROP TABLE t1, t2, t3, trigger_table;
set @@SESSION.SQL_LOG_BIN = @save_log_bin;
"End of tests"
# ==== Purpose ====
#
# Test that sql_mode can correct restore before generating the binlog event
# when creating CREATEable objects.
#
# ==== Method ====
#
# Scan binlog file to check if the sql_mode is still set to 0 before generating binlog event
#
-- source include/master-slave.inc
-- source include/have_log_bin.inc
# BUG#39526 sql_mode not retained in binary log for CREATE PROCEDURE
SET @old_sql_mode= @@global.sql_mode;
SET @old_binlog_format=@@session.binlog_format;
let $MYSQLD_DATADIR= `select @@datadir`;
SET SESSION sql_mode=8;
--echo Initialization
RESET MASTER;
CREATE TABLE t1 (id INT);
CREATE PROCEDURE testProc() SELECT * FROM t1;
CREATE VIEW testView as SELECT * from t1;
DELIMITER |;
CREATE FUNCTION testFunc()
RETURNS INT
BEGIN
return 1;
END;|
DELIMITER ;|
DELIMITER |;
CREATE TRIGGER testTrig BEFORE INSERT ON t1
FOR EACH ROW BEGIN
UPDATE t1 SET id = id +1;
END;|
DELIMITER ;|
DELIMITER |;
CREATE EVENT testEvent ON SCHEDULE
EVERY 1 DAY
DO
BEGIN
UPDATE t1 SET id = id +1;
END;|
DELIMITER ;|
--echo Chceck Result
let $MYSQLD_DATADIR= `select @@datadir`;
--exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug39526.binlog
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval select
(@a:=load_file("$MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug39526.binlog"))
is not null;
let $s_mode_unsigned= `select @a like "%@@session.sql_mode=0%" /* must return 0 */`;
echo *** String sql_mode=0 is found: $s_mode_unsigned ***;
--remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug39526.binlog
--echo Clean Up
DROP PROCEDURE testProc;
DROP FUNCTION testFunc;
DROP TRIGGER testTrig;
DROP EVENT testEvent;
DROP VIEW testView;
DROP TABLE t1;
SET @@global.sql_mode= @old_sql_mode;
SET @@session.binlog_format=@old_binlog_format;
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
# executed cannot be determined (e.g., INSERT DELAYED). Such # executed cannot be determined (e.g., INSERT DELAYED). Such
# statements should be marked unsafe. All unsafe statements should # statements should be marked unsafe. All unsafe statements should
# give a warning. # give a warning.
# Yet the warning/error message isn't issued when SQL_LOG_BIN is turned off.
# #
# This test verifies that a warning is generated for statements that # This test verifies that a warning is generated for statements that
# should be unsafe, when they are executed under statement mode # should be unsafe, when they are executed under statement mode
...@@ -32,14 +33,19 @@ ...@@ -32,14 +33,19 @@
# We try to insert the variables that should not be unsafe into a # We try to insert the variables that should not be unsafe into a
# table, and verify that *no* warning is issued. # table, and verify that *no* warning is issued.
# #
# # Execute a unsafe statement calling a trigger or stored function
# or neither when SQL_LOG_BIN is turned ON, a warning/error should be issued
# Execute a unsafe statement calling a trigger or stored function
# or neither when @@SQL_LOG_BIN is turned OFF,
# no warning/error is issued
# ==== Related bugs and worklogs ==== # ==== Related bugs and worklogs ====
# #
# WL#3339: Issue warnings when statement-based replication may fail # WL#3339: Issue warnings when statement-based replication may fail
# BUG#31168: @@hostname does not replicate # BUG#31168: @@hostname does not replicate
# BUG#34732: mysqlbinlog does not print default values for auto_increment variables # BUG#34732: mysqlbinlog does not print default values for auto_increment variables
# BUG#34768: nondeterministic INSERT using LIMIT logged in stmt mode if binlog_format=mixed # BUG#34768: nondeterministic INSERT using LIMIT logged in stmt mode if binlog_format=mixed
# # BUG#41980, SBL, INSERT .. SELECT .. LIMIT = ERROR, even when @@SQL_LOG_BIN is 0
# #
# ==== Related test cases ==== # ==== Related test cases ====
# #
...@@ -271,3 +277,96 @@ INSERT INTO t1 VALUES ('a','b'); ...@@ -271,3 +277,96 @@ INSERT INTO t1 VALUES ('a','b');
UPDATE t1 SET b = '%s%s%s%s%s%s%s%s%s%s%s%s%s%s' WHERE a = 'a' LIMIT 1; UPDATE t1 SET b = '%s%s%s%s%s%s%s%s%s%s%s%s%s%s' WHERE a = 'a' LIMIT 1;
DROP TABLE t1; DROP TABLE t1;
#
#For bug#41980, SBL, INSERT .. SELECT .. LIMIT = ERROR, even when @@SQL_LOG_BIN is 0
#
--disable_warnings
DROP TABLE IF EXISTS t1, t2;
--enable_warnings
CREATE TABLE t1(i INT PRIMARY KEY);
CREATE TABLE t2(i INT PRIMARY KEY);
CREATE TABLE t3(i INT, ch CHAR(50));
--echo "Should issue message Statement is not safe to log in statement format."
INSERT INTO t1 SELECT * FROM t2 LIMIT 1;
DELIMITER |;
CREATE FUNCTION func6()
RETURNS INT
BEGIN
INSERT INTO t1 VALUES (10);
INSERT INTO t1 VALUES (11);
INSERT INTO t1 VALUES (12);
RETURN 0;
END|
DELIMITER ;|
--echo "Should issue message Statement is not safe to log in statement format only once"
INSERT INTO t3 VALUES(func6(), UUID());
--echo "Check whether SET @@SQL_LOG_BIN = 0/1 doesn't work in substatements"
DELIMITER |;
CREATE FUNCTION fun_check_log_bin() RETURNS INT
BEGIN
SET @@SQL_LOG_BIN = 0;
INSERT INTO t1 VALUES(@@global.sync_binlog);
RETURN 100;
END|
DELIMITER ;|
--echo "One unsafe warning should be issued in the following statement"
SELECT fun_check_log_bin();
--echo "SQL_LOG_BIN should be ON still"
SHOW VARIABLES LIKE "SQL_LOG_BIN";
set @save_log_bin = @@SESSION.SQL_LOG_BIN;
set @@SESSION.SQL_LOG_BIN = 0;
--echo "Should NOT have any warning message issued in the following statements"
INSERT INTO t1 SELECT * FROM t2 LIMIT 1;
DROP TABLE t1,t2;
--echo "Should NOT have any warning message issued in the following func7() and trig"
CREATE TABLE t1 (a INT);
CREATE TABLE t2 (a CHAR(40));
CREATE TABLE trigger_table (a CHAR(7));
DELIMITER |;
CREATE FUNCTION func7()
RETURNS INT
BEGIN
INSERT INTO t1 VALUES (@@global.sync_binlog);
INSERT INTO t1 VALUES (@@session.insert_id);
INSERT INTO t2 SELECT UUID();
INSERT INTO t2 VALUES (@@session.sql_mode);
INSERT INTO t2 VALUES (@@global.init_slave);
RETURN 0;
END|
DELIMITER ;|
SHOW VARIABLES LIKE "SQL_LOG_BIN";
SELECT func7();
--echo ---- Insert from trigger ----
DELIMITER |;
CREATE TRIGGER trig
BEFORE INSERT ON trigger_table
FOR EACH ROW
BEGIN
INSERT INTO t1 VALUES (@@global.sync_binlog);
INSERT INTO t1 VALUES (@@session.insert_id);
INSERT INTO t1 VALUES (@@global.auto_increment_increment);
INSERT INTO t2 SELECT UUID();
INSERT INTO t2 VALUES (@@session.sql_mode);
INSERT INTO t2 VALUES (@@global.init_slave);
INSERT INTO t2 VALUES (@@hostname);
END|
DELIMITER ;|
INSERT INTO trigger_table VALUES ('bye.');
#clean up
DROP FUNCTION fun_check_log_bin;
DROP FUNCTION func6;
DROP FUNCTION func7;
DROP TRIGGER trig;
DROP TABLE t1, t2, t3, trigger_table;
set @@SESSION.SQL_LOG_BIN = @save_log_bin;
--echo "End of tests"
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8;
CREATE TABLE t1 (`bit_key` bit, `bit` bit, key (`bit_key` )) ENGINE=MyISAM;
CREATE TABLE t2 (`bit_key` bit(4), `bit` bit, key (`bit_key` )) ENGINE=MyISAM;
CREATE TABLE t3 (`bit_key` bit(7), `bit` bit, key (`bit_key` )) ENGINE=MyISAM;
CREATE TABLE t4 (`bit_key` bit(8), `bit` bit, key (`bit_key` )) ENGINE=MyISAM;
CREATE TABLE t5 (`bit_key` bit(9), `bit` bit, key (`bit_key` )) ENGINE=MyISAM;
CREATE TABLE t6 (`bit_key` bit(14), `bit` bit, key (`bit_key` )) ENGINE=MyISAM;
CREATE TABLE t7 (`bit_key` bit(15), `bit` bit, key (`bit_key` )) ENGINE=MyISAM;
CREATE TABLE t8 (`bit_key` bit(16), `bit` bit, key (`bit_key` )) ENGINE=MyISAM;
INSERT INTO `t1` ( `bit` ) VALUES ( 0 );
DELETE FROM `t1` WHERE `bit` < 2 LIMIT 4;
INSERT INTO `t2` ( `bit` ) VALUES ( 0 );
DELETE FROM `t2` WHERE `bit` < 2 LIMIT 4;
INSERT INTO `t3` ( `bit` ) VALUES ( 0 );
DELETE FROM `t3` WHERE `bit` < 2 LIMIT 4;
INSERT INTO `t4` ( `bit` ) VALUES ( 0 );
DELETE FROM `t4` WHERE `bit` < 2 LIMIT 4;
INSERT INTO `t5` ( `bit` ) VALUES ( 0 );
DELETE FROM `t5` WHERE `bit` < 2 LIMIT 4;
INSERT INTO `t6` ( `bit` ) VALUES ( 0 );
DELETE FROM `t6` WHERE `bit` < 2 LIMIT 4;
INSERT INTO `t7` ( `bit` ) VALUES ( 0 );
DELETE FROM `t7` WHERE `bit` < 2 LIMIT 4;
INSERT INTO `t8` ( `bit` ) VALUES ( 0 );
DELETE FROM `t8` WHERE `bit` < 2 LIMIT 4;
DROP TABLE t1, t2, t3, t4, t5, t6, t7, t8;
#
# BUG
# ---
# BUG#39753: Replication failure on MIXED + bit + myisam + no PK
#
# Description
# -----------
# Simple statements against a bit column cause failure in mixed-mode
# replication.
#
# Implementation is as follows:
# i) A table with two bit fields is created. One of them is a key.
# ii) A record is inserted without specifying the key value.
# iii) The record is deleted using a where clause that matches it.
# iv) repeat i-iii) for bit key that has different size, generating
# different extra bits values
# v) The slave is synchronized with master
# vi) The table is dropped on master and the slave is re-synchronized
# with master.
#
# Step v) made the bug evident before the patch, as the slave would
# fail to find the correspondent row in its database (although it did
# the insert in step ii) ).
#
# Obs
# ---
# This test is based on the "how to repeat" section from the bug report.
#
#
--source include/master-slave.inc
--disable_warnings
# setup
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8;
CREATE TABLE t1 (`bit_key` bit, `bit` bit, key (`bit_key` )) ENGINE=MyISAM;
CREATE TABLE t2 (`bit_key` bit(4), `bit` bit, key (`bit_key` )) ENGINE=MyISAM;
CREATE TABLE t3 (`bit_key` bit(7), `bit` bit, key (`bit_key` )) ENGINE=MyISAM;
CREATE TABLE t4 (`bit_key` bit(8), `bit` bit, key (`bit_key` )) ENGINE=MyISAM;
CREATE TABLE t5 (`bit_key` bit(9), `bit` bit, key (`bit_key` )) ENGINE=MyISAM;
CREATE TABLE t6 (`bit_key` bit(14), `bit` bit, key (`bit_key` )) ENGINE=MyISAM;
CREATE TABLE t7 (`bit_key` bit(15), `bit` bit, key (`bit_key` )) ENGINE=MyISAM;
CREATE TABLE t8 (`bit_key` bit(16), `bit` bit, key (`bit_key` )) ENGINE=MyISAM;
# insert and delete
INSERT INTO `t1` ( `bit` ) VALUES ( 0 );
DELETE FROM `t1` WHERE `bit` < 2 LIMIT 4;
INSERT INTO `t2` ( `bit` ) VALUES ( 0 );
DELETE FROM `t2` WHERE `bit` < 2 LIMIT 4;
INSERT INTO `t3` ( `bit` ) VALUES ( 0 );
DELETE FROM `t3` WHERE `bit` < 2 LIMIT 4;
INSERT INTO `t4` ( `bit` ) VALUES ( 0 );
DELETE FROM `t4` WHERE `bit` < 2 LIMIT 4;
INSERT INTO `t5` ( `bit` ) VALUES ( 0 );
DELETE FROM `t5` WHERE `bit` < 2 LIMIT 4;
INSERT INTO `t6` ( `bit` ) VALUES ( 0 );
DELETE FROM `t6` WHERE `bit` < 2 LIMIT 4;
INSERT INTO `t7` ( `bit` ) VALUES ( 0 );
DELETE FROM `t7` WHERE `bit` < 2 LIMIT 4;
INSERT INTO `t8` ( `bit` ) VALUES ( 0 );
DELETE FROM `t8` WHERE `bit` < 2 LIMIT 4;
--enable_warnings
sync_slave_with_master;
# clean up
connection master;
DROP TABLE t1, t2, t3, t4, t5, t6, t7, t8;
sync_slave_with_master;
...@@ -143,10 +143,12 @@ set names koi8r| ...@@ -143,10 +143,12 @@ set names koi8r|
# - Dump mysqltest1; # - Dump mysqltest1;
--let $views_dump1 = $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.views.mysqltest1.sql
--echo --echo
--echo ---> Dumping mysqltest1 to ddl_i18n_koi8r.views.mysqltest1.sql --echo ---> Dumping mysqltest1 to ddl_i18n_koi8r.views.mysqltest1.sql
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --databases mysqltest1 > $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.views.mysqltest1.sql --exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --databases mysqltest1 > $views_dump1
# - Clean mysqltest1; # - Clean mysqltest1;
...@@ -161,7 +163,9 @@ DROP DATABASE mysqltest1| ...@@ -161,7 +163,9 @@ DROP DATABASE mysqltest1|
--echo --echo
--echo ---> Restoring mysqltest1... --echo ---> Restoring mysqltest1...
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.views.mysqltest1.sql --exec $MYSQL test < $views_dump1
--remove_file $views_dump1
# #
# Third-round checks. # Third-round checks.
...@@ -398,6 +402,9 @@ set names koi8r| ...@@ -398,6 +402,9 @@ set names koi8r|
# - Dump mysqltest1, mysqltest2; # - Dump mysqltest1, mysqltest2;
--let $sp_dump1 = $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.sp.mysqltest1.sql
--let $sp_dump2 = $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.sp.mysqltest2.sql
--echo --echo
--echo ---> Dump of mysqltest1 --echo ---> Dump of mysqltest1
...@@ -406,7 +413,7 @@ set names koi8r| ...@@ -406,7 +413,7 @@ set names koi8r|
--echo --echo
--echo ---> Dumping mysqltest1 to ddl_i18n_koi8r.sp.mysqltest1.sql --echo ---> Dumping mysqltest1 to ddl_i18n_koi8r.sp.mysqltest1.sql
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --routines --databases mysqltest1 > $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.sp.mysqltest1.sql --exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --routines --databases mysqltest1 > $sp_dump1
--echo --echo
--echo ---> Dump of mysqltest2 --echo ---> Dump of mysqltest2
...@@ -416,7 +423,7 @@ set names koi8r| ...@@ -416,7 +423,7 @@ set names koi8r|
--echo --echo
--echo ---> Dumping mysqltest2 to ddl_i18n_koi8r.sp.mysqltest2.sql --echo ---> Dumping mysqltest2 to ddl_i18n_koi8r.sp.mysqltest2.sql
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --routines --databases mysqltest2 > $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.sp.mysqltest2.sql --exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --routines --databases mysqltest2 > $sp_dump2
# - Clean mysqltest1, mysqltest2; # - Clean mysqltest1, mysqltest2;
...@@ -432,10 +439,13 @@ DROP DATABASE mysqltest2| ...@@ -432,10 +439,13 @@ DROP DATABASE mysqltest2|
--echo --echo
--echo ---> Restoring mysqltest1... --echo ---> Restoring mysqltest1...
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.sp.mysqltest1.sql --exec $MYSQL test < $sp_dump1
--echo ---> Restoring mysqltest2... --echo ---> Restoring mysqltest2...
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.sp.mysqltest2.sql --exec $MYSQL test < $sp_dump2
--remove_file $sp_dump1
--remove_file $sp_dump2
# #
# Third-round checks. # Third-round checks.
...@@ -669,6 +679,9 @@ use mysqltest1| ...@@ -669,6 +679,9 @@ use mysqltest1|
# - Dump mysqltest1, mysqltest2; # - Dump mysqltest1, mysqltest2;
--let $triggers_dump1 = $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.triggers.mysqltest1.sql
--let $triggers_dump2 = $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.triggers.mysqltest2.sql
--echo --echo
--echo ---> Dump of mysqltest1 --echo ---> Dump of mysqltest1
...@@ -677,7 +690,7 @@ use mysqltest1| ...@@ -677,7 +690,7 @@ use mysqltest1|
--echo --echo
--echo ---> Dumping mysqltest1 to ddl_i18n_koi8r.triggers.mysqltest1.sql --echo ---> Dumping mysqltest1 to ddl_i18n_koi8r.triggers.mysqltest1.sql
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --triggers --databases mysqltest1 > $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.triggers.mysqltest1.sql --exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --triggers --databases mysqltest1 > $triggers_dump1
--echo --echo
--echo ---> Dump of mysqltest2 --echo ---> Dump of mysqltest2
...@@ -687,7 +700,7 @@ use mysqltest1| ...@@ -687,7 +700,7 @@ use mysqltest1|
--echo --echo
--echo ---> Dumping mysqltest2 to ddl_i18n_koi8r.triggers.mysqltest2.sql --echo ---> Dumping mysqltest2 to ddl_i18n_koi8r.triggers.mysqltest2.sql
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --triggers --databases mysqltest2 > $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.triggers.mysqltest2.sql --exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --triggers --databases mysqltest2 > $triggers_dump2
# - Clean mysqltest1, mysqltest2; # - Clean mysqltest1, mysqltest2;
...@@ -703,10 +716,13 @@ DROP DATABASE mysqltest2| ...@@ -703,10 +716,13 @@ DROP DATABASE mysqltest2|
--echo --echo
--echo ---> Restoring mysqltest1... --echo ---> Restoring mysqltest1...
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.triggers.mysqltest1.sql --exec $MYSQL test < $triggers_dump1
--echo ---> Restoring mysqltest2... --echo ---> Restoring mysqltest2...
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.triggers.mysqltest2.sql --exec $MYSQL test < $triggers_dump2
--remove_file $triggers_dump1
--remove_file $triggers_dump2
# #
# Third-round checks. # Third-round checks.
...@@ -924,6 +940,9 @@ set names koi8r| ...@@ -924,6 +940,9 @@ set names koi8r|
# - Dump mysqltest1, mysqltest2; # - Dump mysqltest1, mysqltest2;
--let $events_dump1 = $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.events.mysqltest1.sql
--let $events_dump2 = $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.events.mysqltest2.sql
--echo --echo
--echo ---> Dump of mysqltest1 --echo ---> Dump of mysqltest1
...@@ -932,7 +951,7 @@ set names koi8r| ...@@ -932,7 +951,7 @@ set names koi8r|
--echo --echo
--echo ---> Dumping mysqltest1 to ddl_i18n_koi8r.events.mysqltest1.sql --echo ---> Dumping mysqltest1 to ddl_i18n_koi8r.events.mysqltest1.sql
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --events --databases mysqltest1 > $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.events.mysqltest1.sql --exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --events --databases mysqltest1 > $events_dump1
--echo --echo
--echo ---> Dump of mysqltest2 --echo ---> Dump of mysqltest2
...@@ -942,7 +961,7 @@ set names koi8r| ...@@ -942,7 +961,7 @@ set names koi8r|
--echo --echo
--echo ---> Dumping mysqltest2 to ddl_i18n_koi8r.events.mysqltest2.sql --echo ---> Dumping mysqltest2 to ddl_i18n_koi8r.events.mysqltest2.sql
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --events --databases mysqltest2 > $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.events.mysqltest2.sql --exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --events --databases mysqltest2 > $events_dump2
# - Clean mysqltest1, mysqltest2; # - Clean mysqltest1, mysqltest2;
...@@ -958,10 +977,13 @@ DROP DATABASE mysqltest2| ...@@ -958,10 +977,13 @@ DROP DATABASE mysqltest2|
--echo --echo
--echo ---> Restoring mysqltest1... --echo ---> Restoring mysqltest1...
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.events.mysqltest1.sql --exec $MYSQL test < $events_dump1
--echo ---> Restoring mysqltest2... --echo ---> Restoring mysqltest2...
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.events.mysqltest2.sql --exec $MYSQL test < $events_dump2
--remove_file $events_dump1
--remove_file $events_dump2
# #
# Third-round checks. # Third-round checks.
......
...@@ -143,10 +143,12 @@ set names utf8| ...@@ -143,10 +143,12 @@ set names utf8|
# - Dump mysqltest1; # - Dump mysqltest1;
--let $views_dump1 = $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8views.mysqltest1.sql
--echo --echo
--echo ---> Dumping mysqltest1 to ddl_i18n_utf8views.mysqltest1.sql --echo ---> Dumping mysqltest1 to ddl_i18n_utf8views.mysqltest1.sql
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --databases mysqltest1 > $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8views.mysqltest1.sql --exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --databases mysqltest1 > $views_dump1
# - Clean mysqltest1; # - Clean mysqltest1;
...@@ -161,7 +163,9 @@ DROP DATABASE mysqltest1| ...@@ -161,7 +163,9 @@ DROP DATABASE mysqltest1|
--echo --echo
--echo ---> Restoring mysqltest1... --echo ---> Restoring mysqltest1...
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8views.mysqltest1.sql --exec $MYSQL test < $views_dump1
--remove_file $views_dump1
# #
# Third-round checks. # Third-round checks.
...@@ -398,6 +402,9 @@ set names utf8| ...@@ -398,6 +402,9 @@ set names utf8|
# - Dump mysqltest1, mysqltest2; # - Dump mysqltest1, mysqltest2;
--let $sp_dump1 = $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8sp.mysqltest1.sql
--let $sp_dump2 = $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8sp.mysqltest2.sql
--echo --echo
--echo ---> Dump of mysqltest1 --echo ---> Dump of mysqltest1
...@@ -406,7 +413,7 @@ set names utf8| ...@@ -406,7 +413,7 @@ set names utf8|
--echo --echo
--echo ---> Dumping mysqltest1 to ddl_i18n_utf8sp.mysqltest1.sql --echo ---> Dumping mysqltest1 to ddl_i18n_utf8sp.mysqltest1.sql
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --routines --databases mysqltest1 > $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8sp.mysqltest1.sql --exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --routines --databases mysqltest1 > $sp_dump1
--echo --echo
--echo ---> Dump of mysqltest2 --echo ---> Dump of mysqltest2
...@@ -416,7 +423,7 @@ set names utf8| ...@@ -416,7 +423,7 @@ set names utf8|
--echo --echo
--echo ---> Dumping mysqltest2 to ddl_i18n_utf8sp.mysqltest2.sql --echo ---> Dumping mysqltest2 to ddl_i18n_utf8sp.mysqltest2.sql
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --routines --databases mysqltest2 > $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8sp.mysqltest2.sql --exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --routines --databases mysqltest2 > $sp_dump2
# - Clean mysqltest1, mysqltest2; # - Clean mysqltest1, mysqltest2;
...@@ -432,10 +439,13 @@ DROP DATABASE mysqltest2| ...@@ -432,10 +439,13 @@ DROP DATABASE mysqltest2|
--echo --echo
--echo ---> Restoring mysqltest1... --echo ---> Restoring mysqltest1...
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8sp.mysqltest1.sql --exec $MYSQL test < $sp_dump1
--echo ---> Restoring mysqltest2... --echo ---> Restoring mysqltest2...
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8sp.mysqltest2.sql --exec $MYSQL test < $sp_dump2
--remove_file $sp_dump1
--remove_file $sp_dump2
# #
# Third-round checks. # Third-round checks.
...@@ -669,6 +679,9 @@ use mysqltest1| ...@@ -669,6 +679,9 @@ use mysqltest1|
# - Dump mysqltest1, mysqltest2; # - Dump mysqltest1, mysqltest2;
--let $triggers_dump1 = $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8triggers.mysqltest1.sql
--let $triggers_dump2 = $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8triggers.mysqltest2.sql
--echo --echo
--echo ---> Dump of mysqltest1 --echo ---> Dump of mysqltest1
...@@ -677,7 +690,7 @@ use mysqltest1| ...@@ -677,7 +690,7 @@ use mysqltest1|
--echo --echo
--echo ---> Dumping mysqltest1 to ddl_i18n_utf8triggers.mysqltest1.sql --echo ---> Dumping mysqltest1 to ddl_i18n_utf8triggers.mysqltest1.sql
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --triggers --databases mysqltest1 > $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8triggers.mysqltest1.sql --exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --triggers --databases mysqltest1 > $triggers_dump1
--echo --echo
--echo ---> Dump of mysqltest2 --echo ---> Dump of mysqltest2
...@@ -687,7 +700,7 @@ use mysqltest1| ...@@ -687,7 +700,7 @@ use mysqltest1|
--echo --echo
--echo ---> Dumping mysqltest2 to ddl_i18n_utf8triggers.mysqltest2.sql --echo ---> Dumping mysqltest2 to ddl_i18n_utf8triggers.mysqltest2.sql
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --triggers --databases mysqltest2 > $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8triggers.mysqltest2.sql --exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --triggers --databases mysqltest2 > $triggers_dump2
# - Clean mysqltest1, mysqltest2; # - Clean mysqltest1, mysqltest2;
...@@ -703,10 +716,13 @@ DROP DATABASE mysqltest2| ...@@ -703,10 +716,13 @@ DROP DATABASE mysqltest2|
--echo --echo
--echo ---> Restoring mysqltest1... --echo ---> Restoring mysqltest1...
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8triggers.mysqltest1.sql --exec $MYSQL test < $triggers_dump1
--echo ---> Restoring mysqltest2... --echo ---> Restoring mysqltest2...
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8triggers.mysqltest2.sql --exec $MYSQL test < $triggers_dump2
--remove_file $triggers_dump1
--remove_file $triggers_dump2
# #
# Third-round checks. # Third-round checks.
...@@ -924,6 +940,9 @@ set names utf8| ...@@ -924,6 +940,9 @@ set names utf8|
# - Dump mysqltest1, mysqltest2; # - Dump mysqltest1, mysqltest2;
--let $events_dump1 = $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8events.mysqltest1.sql
--let $events_dump2 = $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8events.mysqltest2.sql
--echo --echo
--echo ---> Dump of mysqltest1 --echo ---> Dump of mysqltest1
...@@ -932,7 +951,7 @@ set names utf8| ...@@ -932,7 +951,7 @@ set names utf8|
--echo --echo
--echo ---> Dumping mysqltest1 to ddl_i18n_utf8events.mysqltest1.sql --echo ---> Dumping mysqltest1 to ddl_i18n_utf8events.mysqltest1.sql
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --events --databases mysqltest1 > $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8events.mysqltest1.sql --exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --events --databases mysqltest1 > $events_dump1
--echo --echo
--echo ---> Dump of mysqltest2 --echo ---> Dump of mysqltest2
...@@ -942,7 +961,7 @@ set names utf8| ...@@ -942,7 +961,7 @@ set names utf8|
--echo --echo
--echo ---> Dumping mysqltest2 to ddl_i18n_utf8events.mysqltest2.sql --echo ---> Dumping mysqltest2 to ddl_i18n_utf8events.mysqltest2.sql
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --events --databases mysqltest2 > $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8events.mysqltest2.sql --exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --events --databases mysqltest2 > $events_dump2
# - Clean mysqltest1, mysqltest2; # - Clean mysqltest1, mysqltest2;
...@@ -958,10 +977,13 @@ DROP DATABASE mysqltest2| ...@@ -958,10 +977,13 @@ DROP DATABASE mysqltest2|
--echo --echo
--echo ---> Restoring mysqltest1... --echo ---> Restoring mysqltest1...
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8events.mysqltest1.sql --exec $MYSQL test < $events_dump1
--echo ---> Restoring mysqltest2... --echo ---> Restoring mysqltest2...
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8events.mysqltest2.sql --exec $MYSQL test < $events_dump2
--remove_file $events_dump1
--remove_file $events_dump2
# #
# Third-round checks. # Third-round checks.
......
...@@ -150,17 +150,30 @@ DROP DATABASE IF EXISTS mysql_test; ...@@ -150,17 +150,30 @@ DROP DATABASE IF EXISTS mysql_test;
CREATE DATABASE mysql_test; CREATE DATABASE mysql_test;
let $MYSQLD_DATADIR= `select @@datadir`; let $MYSQLD_DATADIR= `select @@datadir`;
--copy_file $MYSQLD_DATADIR/mysql/proc.frm $MYSQLTEST_VARDIR/tmp/bug29958.proc.frm
--copy_file $MYSQLD_DATADIR/mysql/proc.MYD $MYSQLTEST_VARDIR/tmp/bug29958.proc.MYD --let $proc_frm = $MYSQLD_DATADIR/mysql/proc.frm
--copy_file $MYSQLD_DATADIR/mysql/proc.MYI $MYSQLTEST_VARDIR/tmp/bug29958.proc.MYI --let $proc_MYD = $MYSQLD_DATADIR/mysql/proc.MYD
--let $proc_MYI = $MYSQLD_DATADIR/mysql/proc.MYI
--let $copy_of_proc_frm = $MYSQLTEST_VARDIR/tmp/bug29958.copy.frm
--let $copy_of_proc_MYD = $MYSQLTEST_VARDIR/tmp/bug29958.copy.MYD
--let $copy_of_proc_MYI = $MYSQLTEST_VARDIR/tmp/bug29958.copy.MYI
--copy_file $proc_frm $copy_of_proc_frm
--copy_file $proc_MYD $copy_of_proc_MYD
--copy_file $proc_MYI $copy_of_proc_MYI
DROP TABLE mysql.proc; DROP TABLE mysql.proc;
DROP DATABASE mysql_test; DROP DATABASE mysql_test;
--copy_file $MYSQLTEST_VARDIR/tmp/bug29958.proc.frm $MYSQLD_DATADIR/mysql/proc.frm --copy_file $copy_of_proc_frm $proc_frm
--copy_file $MYSQLTEST_VARDIR/tmp/bug29958.proc.MYD $MYSQLD_DATADIR/mysql/proc.MYD --copy_file $copy_of_proc_MYD $proc_MYD
--copy_file $MYSQLTEST_VARDIR/tmp/bug29958.proc.MYI $MYSQLD_DATADIR/mysql/proc.MYI --copy_file $copy_of_proc_MYI $proc_MYI
--remove_file $copy_of_proc_frm
--remove_file $copy_of_proc_MYD
--remove_file $copy_of_proc_MYI
--echo --echo
--echo # -- --echo # --
......
...@@ -15,6 +15,9 @@ DROP USER mysqltest_1@'127.0.0.1/255.255.255.255'; ...@@ -15,6 +15,9 @@ DROP USER mysqltest_1@'127.0.0.1/255.255.255.255';
connect (con1, 127.0.0.1, root, , test, $MASTER_MYPORT, ); connect (con1, 127.0.0.1, root, , test, $MASTER_MYPORT, );
--replace_column 1 # --replace_column 1 #
select user(); select user();
--replace_column 1 <id> 3 <host> 5 <command> 6 <time> 7 <state> 8 <info> # We are only interested in the fact that statement below doesn't
# crash server.
--disable_result_log
show processlist; show processlist;
--enable_result_log
connection default; connection default;
...@@ -1121,3 +1121,10 @@ SET @@session.thread_stack= 7; ...@@ -1121,3 +1121,10 @@ SET @@session.thread_stack= 7;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR --error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@global.thread_stack= 7; SET @@global.thread_stack= 7;
# #
#
# Bug#41030 Wrong meta data (incorrect fieldlen)
#
--enable_metadata
select @@storage_engine;
--disable_metadata
...@@ -4837,7 +4837,9 @@ bool Item_func_get_system_var::is_written_to_binlog() ...@@ -4837,7 +4837,9 @@ bool Item_func_get_system_var::is_written_to_binlog()
void Item_func_get_system_var::fix_length_and_dec() void Item_func_get_system_var::fix_length_and_dec()
{ {
char *cptr;
maybe_null=0; maybe_null=0;
max_length= 0;
if (var->check_type(var_type)) if (var->check_type(var_type))
{ {
...@@ -4867,8 +4869,14 @@ void Item_func_get_system_var::fix_length_and_dec() ...@@ -4867,8 +4869,14 @@ void Item_func_get_system_var::fix_length_and_dec()
break; break;
case SHOW_CHAR: case SHOW_CHAR:
case SHOW_CHAR_PTR: case SHOW_CHAR_PTR:
pthread_mutex_lock(&LOCK_global_system_variables);
cptr= var->show_type() == SHOW_CHAR_PTR ?
*(char**) var->value_ptr(current_thd, var_type, &component) :
(char*) var->value_ptr(current_thd, var_type, &component);
if (cptr)
max_length= strlen(cptr) * system_charset_info->mbmaxlen;
pthread_mutex_unlock(&LOCK_global_system_variables);
collation.set(system_charset_info, DERIVATION_SYSCONST); collation.set(system_charset_info, DERIVATION_SYSCONST);
max_length= MAX_BLOB_WIDTH;
decimals=NOT_FIXED_DEC; decimals=NOT_FIXED_DEC;
break; break;
case SHOW_BOOL: case SHOW_BOOL:
......
...@@ -297,21 +297,16 @@ unpack_row(Relay_log_info const *rli, ...@@ -297,21 +297,16 @@ unpack_row(Relay_log_info const *rli,
/** /**
Fills @c table->record[0] with default values. Fills @c table->record[0] with default values.
First @c empty_record() is called and then, additionally, fields are First @c restore_record() is called to restore the default values for
initialized explicitly with a call to @c set_default(). record concerning the given table. Then, if @c check is true,
a check is performed to see if fields are have default value or can
For optimization reasons, the explicit initialization can be skipped for be NULL. Otherwise error is reported.
first @c skip fields. This is useful if later we are going to fill these
fields from other source (e.g. from a Rows replication event).
If @c check is true, fields are explicitly initialized only if they have
default value or can be NULL. Otherwise error is reported.
@param table Table whose record[0] buffer is prepared. @param table Table whose record[0] buffer is prepared.
@param skip Number of columns for which default value initialization @param skip Number of columns for which default/nullable check
should be skipped. should be skipped.
@param check Indicates if errors should be checked when setting default @param check Indicates if errors should be raised when checking
values. default/nullable field properties.
@returns 0 on success or a handler level error code @returns 0 on success or a handler level error code
*/ */
...@@ -321,25 +316,28 @@ int prepare_record(TABLE *const table, ...@@ -321,25 +316,28 @@ int prepare_record(TABLE *const table,
DBUG_ENTER("prepare_record"); DBUG_ENTER("prepare_record");
int error= 0; int error= 0;
empty_record(table); restore_record(table, s->default_values);
if (skip >= table->s->fields) // nothing to do /*
This skip should be revisited in 6.0, because in 6.0 RBR one
can have holes in the row (as the grain of the writeset is
the column and not the entire row).
*/
if (skip >= table->s->fields || !check)
DBUG_RETURN(0); DBUG_RETURN(0);
/* Explicit initialization of fields */ /* Checking if exists default/nullable fields in the default values. */
for (Field **field_ptr= table->field+skip ; *field_ptr ; ++field_ptr) for (Field **field_ptr= table->field+skip ; *field_ptr ; ++field_ptr)
{ {
uint32 const mask= NOT_NULL_FLAG | NO_DEFAULT_VALUE_FLAG; uint32 const mask= NOT_NULL_FLAG | NO_DEFAULT_VALUE_FLAG;
Field *const f= *field_ptr; Field *const f= *field_ptr;
if (check && ((f->flags & mask) == mask)) if (((f->flags & mask) == mask))
{ {
my_error(ER_NO_DEFAULT_FOR_FIELD, MYF(0), f->field_name); my_error(ER_NO_DEFAULT_FOR_FIELD, MYF(0), f->field_name);
error = HA_ERR_ROWS_EVENT_APPLY; error = HA_ERR_ROWS_EVENT_APPLY;
} }
else
f->set_default();
} }
DBUG_RETURN(error); DBUG_RETURN(error);
......
...@@ -110,6 +110,7 @@ static void sys_default_init_connect(THD*, enum_var_type type); ...@@ -110,6 +110,7 @@ static void sys_default_init_connect(THD*, enum_var_type type);
static bool sys_update_init_slave(THD*, set_var*); static bool sys_update_init_slave(THD*, set_var*);
static void sys_default_init_slave(THD*, enum_var_type type); static void sys_default_init_slave(THD*, enum_var_type type);
static bool set_option_bit(THD *thd, set_var *var); static bool set_option_bit(THD *thd, set_var *var);
static bool set_option_log_bin_bit(THD *thd, set_var *var);
static bool set_option_autocommit(THD *thd, set_var *var); static bool set_option_autocommit(THD *thd, set_var *var);
static int check_log_update(THD *thd, set_var *var); static int check_log_update(THD *thd, set_var *var);
static bool set_log_update(THD *thd, set_var *var); static bool set_log_update(THD *thd, set_var *var);
...@@ -731,7 +732,7 @@ static sys_var_thd_bit sys_log_update(&vars, "sql_log_update", ...@@ -731,7 +732,7 @@ static sys_var_thd_bit sys_log_update(&vars, "sql_log_update",
OPTION_BIN_LOG); OPTION_BIN_LOG);
static sys_var_thd_bit sys_log_binlog(&vars, "sql_log_bin", static sys_var_thd_bit sys_log_binlog(&vars, "sql_log_bin",
check_log_update, check_log_update,
set_option_bit, set_option_log_bin_bit,
OPTION_BIN_LOG); OPTION_BIN_LOG);
static sys_var_thd_bit sys_sql_warnings(&vars, "sql_warnings", 0, static sys_var_thd_bit sys_sql_warnings(&vars, "sql_warnings", 0,
set_option_bit, set_option_bit,
...@@ -2963,6 +2964,16 @@ static bool set_option_bit(THD *thd, set_var *var) ...@@ -2963,6 +2964,16 @@ static bool set_option_bit(THD *thd, set_var *var)
return 0; return 0;
} }
/*
Functions to be only used to update thd->options OPTION_BIN_LOG bit
*/
static bool set_option_log_bin_bit(THD *thd, set_var *var)
{
set_option_bit(thd, var);
if (!thd->in_sub_stmt)
thd->sql_log_bin_toplevel= thd->options & OPTION_BIN_LOG;
return 0;
}
static bool set_option_autocommit(THD *thd, set_var *var) static bool set_option_autocommit(THD *thd, set_var *var)
{ {
......
...@@ -936,10 +936,12 @@ sp_create_routine(THD *thd, int type, sp_head *sp) ...@@ -936,10 +936,12 @@ sp_create_routine(THD *thd, int type, sp_head *sp)
ret= SP_INTERNAL_ERROR; ret= SP_INTERNAL_ERROR;
goto done; goto done;
} }
/* restore sql_mode when binloging */
thd->variables.sql_mode= saved_mode;
/* Such a statement can always go directly to binlog, no trans cache */ /* Such a statement can always go directly to binlog, no trans cache */
thd->binlog_query(THD::MYSQL_QUERY_TYPE, thd->binlog_query(THD::MYSQL_QUERY_TYPE,
log_query.c_ptr(), log_query.length(), FALSE, FALSE); log_query.c_ptr(), log_query.length(), FALSE, FALSE);
thd->variables.sql_mode= 0;
} }
} }
......
...@@ -538,6 +538,7 @@ THD::THD() ...@@ -538,6 +538,7 @@ THD::THD()
Open_tables_state(refresh_version), rli_fake(0), Open_tables_state(refresh_version), rli_fake(0),
lock_id(&main_lock_id), lock_id(&main_lock_id),
user_time(0), in_sub_stmt(0), user_time(0), in_sub_stmt(0),
sql_log_bin_toplevel(false),
binlog_table_maps(0), binlog_flags(0UL), binlog_table_maps(0), binlog_flags(0UL),
table_map_for_update(0), table_map_for_update(0),
arg_of_last_insert_id_function(FALSE), arg_of_last_insert_id_function(FALSE),
...@@ -787,6 +788,7 @@ void THD::init(void) ...@@ -787,6 +788,7 @@ void THD::init(void)
update_charset(); update_charset();
reset_current_stmt_binlog_row_based(); reset_current_stmt_binlog_row_based();
bzero((char *) &status_var, sizeof(status_var)); bzero((char *) &status_var, sizeof(status_var));
sql_log_bin_toplevel= options & OPTION_BIN_LOG;
} }
...@@ -3662,7 +3664,7 @@ int THD::binlog_query(THD::enum_binlog_query_type qtype, char const *query_arg, ...@@ -3662,7 +3664,7 @@ int THD::binlog_query(THD::enum_binlog_query_type qtype, char const *query_arg,
If we are in statement mode and trying to log an unsafe statement, If we are in statement mode and trying to log an unsafe statement,
we should print a warning. we should print a warning.
*/ */
if (lex->is_stmt_unsafe() && if (sql_log_bin_toplevel && lex->is_stmt_unsafe() &&
variables.binlog_format == BINLOG_FORMAT_STMT) variables.binlog_format == BINLOG_FORMAT_STMT)
{ {
push_warning(this, MYSQL_ERROR::WARN_LEVEL_WARN, push_warning(this, MYSQL_ERROR::WARN_LEVEL_WARN,
......
...@@ -1350,6 +1350,8 @@ public: ...@@ -1350,6 +1350,8 @@ public:
/* <> 0 if we are inside of trigger or stored function. */ /* <> 0 if we are inside of trigger or stored function. */
uint in_sub_stmt; uint in_sub_stmt;
/* TRUE when the current top has SQL_LOG_BIN ON */
bool sql_log_bin_toplevel;
/* container for handler's private per-connection data */ /* container for handler's private per-connection data */
Ha_data ha_data[MAX_HA]; Ha_data ha_data[MAX_HA];
......
...@@ -3796,8 +3796,19 @@ static int get_schema_column_record(THD *thd, TABLE_LIST *tables, ...@@ -3796,8 +3796,19 @@ static int get_schema_column_record(THD *thd, TABLE_LIST *tables,
cs); cs);
table->field[4]->store((longlong) count, TRUE); table->field[4]->store((longlong) count, TRUE);
field->sql_type(type); field->sql_type(type);
table->field[14]->store(type.ptr(), type.length(), cs); table->field[14]->store(type.ptr(), type.length(), cs);
/*
MySQL column type has the following format:
base_type [(dimension)] [unsigned] [zerofill].
For DATA_TYPE column we extract only base type.
*/
tmp_buff= strchr(type.ptr(), '('); tmp_buff= strchr(type.ptr(), '(');
if (!tmp_buff)
/*
if there is no dimention part then check the presence of
[unsigned] [zerofill] attributes and cut them of if exist.
*/
tmp_buff= strchr(type.ptr(), ' ');
table->field[7]->store(type.ptr(), table->field[7]->store(type.ptr(),
(tmp_buff ? tmp_buff - type.ptr() : (tmp_buff ? tmp_buff - type.ptr() :
type.length()), cs); type.length()), cs);
......
...@@ -4298,7 +4298,8 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, ...@@ -4298,7 +4298,8 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_ERROR, push_warning(thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
ER_VIEW_CHECKSUM, ER(ER_VIEW_CHECKSUM)); ER_VIEW_CHECKSUM, ER(ER_VIEW_CHECKSUM));
if (thd->main_da.is_error() && if (thd->main_da.is_error() &&
thd->main_da.sql_errno() == ER_NO_SUCH_TABLE) (thd->main_da.sql_errno() == ER_NO_SUCH_TABLE ||
thd->main_da.sql_errno() == ER_FILE_NOT_FOUND))
/* A missing table is just issued as a failed command */ /* A missing table is just issued as a failed command */
result_code= HA_ADMIN_FAILED; result_code= HA_ADMIN_FAILED;
else else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment