MDEV-30469 Feature rebase

Upon rebase, some error codes changed order so record tests to
update accordingly.  Merge with trigger changes from MDEV-34724.
This commit is contained in:
Dave Gosselin 2025-02-05 10:41:11 -05:00
parent 5e07d1abd4
commit edd52b7fc7
3 changed files with 40 additions and 25 deletions

View File

@ -777,7 +777,7 @@ id
1 1
2 2
Warnings: Warnings:
Warning 4206 Index hints are ignored because they are incompatible with RETURNING clause Warning 4207 Index hints are ignored because they are incompatible with RETURNING clause
drop table t2; drop table t2;
# #
# End of 11.4 test # End of 11.4 test

View File

@ -14,7 +14,7 @@ $
# invoked from the trigger # invoked from the trigger
INSERT INTO t1 VALUES (1), (2), (3); INSERT INTO t1 VALUES (1), (2), (3);
Warnings: Warnings:
Error 4207 The row is skipped by a trigger implementation Error 4208 The row is skipped by a trigger implementation
Note 4094 At line 4 in test.t1_bi Note 4094 At line 4 in test.t1_bi
# Expected output is the rows (2), (3) # Expected output is the rows (2), (3)
SELECT * FROM t1; SELECT * FROM t1;
@ -32,9 +32,9 @@ INSERT INTO t2 VALUES (1), (2), (1), (3), (5);
# invoked from the trigger # invoked from the trigger
INSERT INTO t1 SELECT * FROM t2; INSERT INTO t1 SELECT * FROM t2;
Warnings: Warnings:
Error 4207 The row is skipped by a trigger implementation Error 4208 The row is skipped by a trigger implementation
Note 4094 At line 4 in test.t1_bi Note 4094 At line 4 in test.t1_bi
Error 4207 The row is skipped by a trigger implementation Error 4208 The row is skipped by a trigger implementation
Note 4094 At line 4 in test.t1_bi Note 4094 At line 4 in test.t1_bi
# Expected output is the rows (2), (3), (5) # Expected output is the rows (2), (3), (5)
SELECT * FROM t1; SELECT * FROM t1;
@ -66,9 +66,9 @@ SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t2' FROM t2;
# invoked from the trigger # invoked from the trigger
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t2' INTO TABLE t1; LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t2' INTO TABLE t1;
Warnings: Warnings:
Error 4207 The row is skipped by a trigger implementation Error 4208 The row is skipped by a trigger implementation
Note 4094 At line 4 in test.t1_bi Note 4094 At line 4 in test.t1_bi
Error 4207 The row is skipped by a trigger implementation Error 4208 The row is skipped by a trigger implementation
Note 4094 At line 4 in test.t1_bi Note 4094 At line 4 in test.t1_bi
# Querying of the table `t1` should return three rows: (2), (3), (5) # Querying of the table `t1` should return three rows: (2), (3), (5)
SELECT * FROM t1; SELECT * FROM t1;
@ -89,9 +89,9 @@ TRUNCATE TABLE t1;
# invoked from the trigger # invoked from the trigger
LOAD XML INFILE 'MYSQLTEST_VARDIR/tmp/loadxml-dump.xml' INTO TABLE t1 ROWS IDENTIFIED BY '<row>'; LOAD XML INFILE 'MYSQLTEST_VARDIR/tmp/loadxml-dump.xml' INTO TABLE t1 ROWS IDENTIFIED BY '<row>';
Warnings: Warnings:
Error 4207 The row is skipped by a trigger implementation Error 4208 The row is skipped by a trigger implementation
Note 4094 At line 4 in test.t1_bi Note 4094 At line 4 in test.t1_bi
Error 4207 The row is skipped by a trigger implementation Error 4208 The row is skipped by a trigger implementation
Note 4094 At line 4 in test.t1_bi Note 4094 At line 4 in test.t1_bi
SELECT * FROM t1; SELECT * FROM t1;
a a
@ -118,9 +118,9 @@ $
# invoked from the trigger # invoked from the trigger
DELETE FROM t1 WHERE a = 1; DELETE FROM t1 WHERE a = 1;
Warnings: Warnings:
Error 4207 The row is skipped by a trigger implementation Error 4208 The row is skipped by a trigger implementation
Note 4094 At line 4 in test.t1_bi Note 4094 At line 4 in test.t1_bi
Error 4207 The row is skipped by a trigger implementation Error 4208 The row is skipped by a trigger implementation
Note 4094 At line 4 in test.t1_bi Note 4094 At line 4 in test.t1_bi
# Show that the rows satisfying the condition a = 1 are retained # Show that the rows satisfying the condition a = 1 are retained
# in the table. Expected output is the rows (1), (2), (3), (1) # in the table. Expected output is the rows (1), (2), (3), (1)
@ -143,9 +143,9 @@ a
# account the fact that some of rows should be skipped. # account the fact that some of rows should be skipped.
DELETE FROM t1; DELETE FROM t1;
Warnings: Warnings:
Error 4207 The row is skipped by a trigger implementation Error 4208 The row is skipped by a trigger implementation
Note 4094 At line 4 in test.t1_bi Note 4094 At line 4 in test.t1_bi
Error 4207 The row is skipped by a trigger implementation Error 4208 The row is skipped by a trigger implementation
Note 4094 At line 4 in test.t1_bi Note 4094 At line 4 in test.t1_bi
# Expected output is the rows (1), (1) since they are explicilty # Expected output is the rows (1), (1) since they are explicilty
# skipped by the trigger logic # skipped by the trigger logic
@ -175,7 +175,7 @@ END
$ $
INSERT INTO t1 VALUES (1), (2), (3); INSERT INTO t1 VALUES (1), (2), (3);
Warnings: Warnings:
Error 4207 The row is skipped by a trigger implementation Error 4208 The row is skipped by a trigger implementation
Note 4094 At line 4 in test.t1_bi Note 4094 At line 4 in test.t1_bi
SELECT * FROM t1; SELECT * FROM t1;
a a
@ -205,7 +205,7 @@ END
$ $
DELETE FROM t1; DELETE FROM t1;
Warnings: Warnings:
Error 4207 The row is skipped by a trigger implementation Error 4208 The row is skipped by a trigger implementation
Note 4094 At line 4 in test.t1_bd Note 4094 At line 4 in test.t1_bd
# The row (1) is skipped by implementation of the trigger t1_bd, # The row (1) is skipped by implementation of the trigger t1_bd,
# therefore the row (1) isn't inserted into the table t2 since # therefore the row (1) isn't inserted into the table t2 since
@ -241,7 +241,7 @@ $
# for this row and the row (1, 11) not inserted into the table t2 # for this row and the row (1, 11) not inserted into the table t2
UPDATE t1 SET a = a + 10; UPDATE t1 SET a = a + 10;
Warnings: Warnings:
Error 4207 The row is skipped by a trigger implementation Error 4208 The row is skipped by a trigger implementation
Note 4094 At line 4 in test.t1_bu Note 4094 At line 4 in test.t1_bu
# Expected output of the following statement SELECT is (1), (12), (13) # Expected output of the following statement SELECT is (1), (12), (13)
SELECT * FROM t1; SELECT * FROM t1;
@ -270,9 +270,9 @@ $
# Check for update with condition # Check for update with condition
UPDATE t1 SET a = 1000 WHERE a = 1; UPDATE t1 SET a = 1000 WHERE a = 1;
Warnings: Warnings:
Error 4207 The row is skipped by a trigger implementation Error 4208 The row is skipped by a trigger implementation
Note 4094 At line 4 in test.t1_bd Note 4094 At line 4 in test.t1_bd
Error 4207 The row is skipped by a trigger implementation Error 4208 The row is skipped by a trigger implementation
Note 4094 At line 4 in test.t1_bd Note 4094 At line 4 in test.t1_bd
# Expected result is the rows (1), (2), (1), (3), (5) # Expected result is the rows (1), (2), (1), (3), (5)
SELECT * FROM t1; SELECT * FROM t1;
@ -285,9 +285,9 @@ a
# Check for unconditional update # Check for unconditional update
UPDATE t1 SET a = a + 100; UPDATE t1 SET a = a + 100;
Warnings: Warnings:
Error 4207 The row is skipped by a trigger implementation Error 4208 The row is skipped by a trigger implementation
Note 4094 At line 4 in test.t1_bd Note 4094 At line 4 in test.t1_bd
Error 4207 The row is skipped by a trigger implementation Error 4208 The row is skipped by a trigger implementation
Note 4094 At line 4 in test.t1_bd Note 4094 At line 4 in test.t1_bd
# Expected result is the rows (1), (102), (1), (103), (105) # Expected result is the rows (1), (102), (1), (103), (105)
SELECT * FROM t1; SELECT * FROM t1;
@ -307,9 +307,9 @@ INSERT INTO t2 VALUES (1), (3);
# the second table (without a trigger) is still updated # the second table (without a trigger) is still updated
UPDATE t1, t2 SET t1.a = t1.a + 300, t2.a = t2.a + 300 WHERE t1.a = t2.a; UPDATE t1, t2 SET t1.a = t1.a + 300, t2.a = t2.a + 300 WHERE t1.a = t2.a;
Warnings: Warnings:
Error 4207 The row is skipped by a trigger implementation Error 4208 The row is skipped by a trigger implementation
Note 4094 At line 4 in test.t1_bd Note 4094 At line 4 in test.t1_bd
Error 4207 The row is skipped by a trigger implementation Error 4208 The row is skipped by a trigger implementation
Note 4094 At line 4 in test.t1_bd Note 4094 At line 4 in test.t1_bd
# Expected results is the rows (1), (2), (1), (303), (5) # Expected results is the rows (1), (2), (1), (303), (5)
SELECT * FROM t1; SELECT * FROM t1;

View File

@ -1355,13 +1355,19 @@ int multi_delete::send_data(List<Item> &values)
if (secure_counter < 0) if (secure_counter < 0)
{ {
bool trg_skip_row= false;
/* We are scanning the current table */ /* We are scanning the current table */
DBUG_ASSERT(del_table == table_being_deleted); DBUG_ASSERT(del_table == table_being_deleted);
if (table->triggers && if (table->triggers &&
table->triggers->process_triggers(thd, TRG_EVENT_DELETE, table->triggers->process_triggers(thd, TRG_EVENT_DELETE,
TRG_ACTION_BEFORE, false)) TRG_ACTION_BEFORE, false,
&trg_skip_row))
DBUG_RETURN(1); DBUG_RETURN(1);
if (trg_skip_row)
continue;
table->status|= STATUS_DELETED; table->status|= STATUS_DELETED;
error= table->delete_row(); error= table->delete_row();
@ -1372,7 +1378,8 @@ int multi_delete::send_data(List<Item> &values)
thd->transaction->stmt.modified_non_trans_table= TRUE; thd->transaction->stmt.modified_non_trans_table= TRUE;
if (table->triggers && if (table->triggers &&
table->triggers->process_triggers(thd, TRG_EVENT_DELETE, table->triggers->process_triggers(thd, TRG_EVENT_DELETE,
TRG_ACTION_AFTER, false)) TRG_ACTION_AFTER, false,
nullptr))
DBUG_RETURN(1); DBUG_RETURN(1);
} }
else if (!ignore) else if (!ignore)
@ -1584,14 +1591,21 @@ int multi_delete::rowid_table_deletes(TABLE *table, bool ignore)
continue; continue;
} }
bool trg_skip_row= false;
if (table->triggers && if (table->triggers &&
unlikely(table->triggers->process_triggers(thd, TRG_EVENT_DELETE, unlikely(table->triggers->process_triggers(thd, TRG_EVENT_DELETE,
TRG_ACTION_BEFORE, FALSE))) TRG_ACTION_BEFORE, FALSE,
&trg_skip_row)))
{ {
err_table= table; err_table= table;
local_error= 1; local_error= 1;
break; break;
} }
if (trg_skip_row)
continue;
local_error= table->delete_row(); local_error= table->delete_row();
if (unlikely(local_error) && !ignore) if (unlikely(local_error) && !ignore)
{ {
@ -1609,7 +1623,8 @@ int multi_delete::rowid_table_deletes(TABLE *table, bool ignore)
deleted++; deleted++;
if (table->triggers && if (table->triggers &&
table->triggers->process_triggers(thd, TRG_EVENT_DELETE, table->triggers->process_triggers(thd, TRG_EVENT_DELETE,
TRG_ACTION_AFTER, FALSE)) TRG_ACTION_AFTER, FALSE,
nullptr))
{ {
err_table= table; err_table= table;
local_error= 1; local_error= 1;