| 1 |
# |
| 2 |
# MDEV-25154: JSON_TABLE: Queries involving ordinality columns are unsafe for statement binlog and should be marked as such |
| 3 |
# |
| 4 |
create table t1 (a int); |
| 5 |
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); |
| 6 |
set binlog_format='statement'; |
| 7 |
insert into t1 |
| 8 |
select * |
| 9 |
from json_table('[1,2,3]', '$[*]' columns (a for ordinality)) as T ; |
| 10 |
Warnings: |
| 11 |
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave |
| 12 |
set binlog_format='mixed'; |
| 13 |
insert into t1 |
| 14 |
select * |
| 15 |
from json_table('[1,2,3]', '$[*]' columns (a for ordinality)) as T ; |
| 16 |
# This must show Annotate_rows, Write_rows_v1 events. Not the statement event |
| 17 |
include/show_binlog_events.inc |
| 18 |
Log_name Pos Event_type Server_id End_log_pos Info |
| 19 |
master-bin.000001 # Gtid # # BEGIN GTID #-#-# |
| 20 |
master-bin.000001 # Annotate_rows # # insert into t1 |
| 21 |
select * |
| 22 |
from json_table('[1,2,3]', '$[*]' columns (a for ordinality)) as T |
| 23 |
master-bin.000001 # Table_map # # table_id: # (test.t1) |
| 24 |
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F |
| 25 |
master-bin.000001 # Query # # COMMIT |
| 26 |
drop table t1; |