Skip to content
/ server Public
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
reset master;
set foreign_key_checks= 0, sql_auto_is_null=1, check_constraint_checks=0, unique_checks=0;
create table t (a int, check(a>1), foreign key(a) references x (x)) engine=InnoDB as select 1 as a;
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; set foreign_key_checks=0, sql_auto_is_null=1, unique_checks=0; create table t (a int, check(a>1), foreign key(a) references x (x)) engine=InnoDB as select 1 as a
drop table t;
reset master;
2 changes: 1 addition & 1 deletion mysql-test/suite/binlog/r/foreign_key.result
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; set foreign_key_checks=1; DROP TABLE `t1` /* generated by server */
master-bin.000001 # Query # # use `test`; set foreign_key_checks=0; DROP TABLE `t1` /* generated by server */
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# ==== Purpose ====
#
# Test verifies that reading binary log by using "SHOW BINLOG EVENTS" command
# from should correctly print the values of session variables such as
# foreign_key_checks, sql_auto_is_null, unique_checks etc
#
# ==== References ====
#
# MDEV-29804 SHOW BINLOG EVENTS produces semantically/syntactically incorrect statements


--source include/have_log_bin.inc
--source include/have_innodb.inc
--source include/have_binlog_format_statement.inc

reset master;

set foreign_key_checks= 0, sql_auto_is_null=1, check_constraint_checks=0, unique_checks=0;
create table t (a int, check(a>1), foreign key(a) references x (x)) engine=InnoDB as select 1 as a;

source include/show_binlog_events.inc;

# Cleanup
drop table t;
reset master;
4 changes: 2 additions & 2 deletions mysql-test/suite/rpl/r/rpl_alter_rollback.result
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ master-bin.000001 # Query # # use `test`; alter table t2 add constraint c1 forei
master-bin.000001 # Gtid # # GTID #-#-# ROLLBACK ALTER id=#
master-bin.000001 # Query # # use `test`; alter table t2 add constraint c1 foreign key (f1) references t1(f1)
master-bin.000001 # Gtid # # GTID #-#-# START ALTER
master-bin.000001 # Query # # use `test`; set foreign_key_checks=1; alter table t2 add constraint c1 foreign key (f1) references t1(f1)
master-bin.000001 # Query # # use `test`; set foreign_key_checks=0; alter table t2 add constraint c1 foreign key (f1) references t1(f1)
master-bin.000001 # Gtid # # GTID #-#-# ROLLBACK ALTER id=#
master-bin.000001 # Query # # use `test`; set foreign_key_checks=1; alter table t2 add constraint c1 foreign key (f1) references t1(f1)
master-bin.000001 # Query # # use `test`; set foreign_key_checks=0; alter table t2 add constraint c1 foreign key (f1) references t1(f1)
connection slave;
connection master;
drop table t2, t1;
Expand Down
8 changes: 4 additions & 4 deletions sql/log_event_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1064,13 +1064,13 @@ void Query_log_event::pack_info(Protocol *protocol)
{
buf.append(STRING_WITH_LEN("set "));
if (flags2 & OPTION_NO_FOREIGN_KEY_CHECKS)
buf.append(STRING_WITH_LEN("foreign_key_checks=1, "));
buf.append(STRING_WITH_LEN("foreign_key_checks=0, "));
if (flags2 & OPTION_AUTO_IS_NULL)
buf.append(STRING_WITH_LEN("sql_auto_is_null, "));
buf.append(STRING_WITH_LEN("sql_auto_is_null=1, "));
if (flags2 & OPTION_RELAXED_UNIQUE_CHECKS)
buf.append(STRING_WITH_LEN("unique_checks=1, "));
buf.append(STRING_WITH_LEN("unique_checks=0, "));
if (flags2 & OPTION_NO_CHECK_CONSTRAINT_CHECKS)
buf.append(STRING_WITH_LEN("check_constraint_checks=1, "));
buf.append(STRING_WITH_LEN("check_constraint_checks=0, "));
if (flags2 & OPTION_IF_EXISTS)
buf.append(STRING_WITH_LEN("@@sql_if_exists=1, "));
if (flags2 & OPTION_INSERT_HISTORY)
Expand Down