1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-07 00:04:31 +03:00

Make error messages from DROP TABLE and DROP TABLE IF EXISTS consistent

- IF EXISTS ends with a list of all not existing object, instead of a
  separate note for every not existing object
- Produce a "Note" for all wrongly dropped objects
  (like trying to do DROP SEQUENCE for a normal table)
- Do not write existing tables that could not be dropped to binlog

Other things:
MDEV-22820 Bogus "Unknown table" warnings produced upon attempt to drop
           parent table referenced by FK
This was caused by an older version of this commit patch and later fixed
This commit is contained in:
Monty
2020-06-05 18:55:11 +03:00
parent 346d10a953
commit dfb41fddf6
25 changed files with 431 additions and 215 deletions

View File

@@ -164,3 +164,47 @@ master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE TABLE t1(id int)
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS /* */ `t1` /* generated by server */
#
# MDEV-22820 Bogus "Unknown table" warnings produced upon attempt to
# drop parent table referenced by FK
#
create table t1 (a int, key(a)) engine=InnoDB;
create table t2 (b int, foreign key(b) references t1(a)) engine=InnoDB;
drop table if exists t1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails
drop table if exists t1,t0;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails
show warnings;
Level Code Message
Error 1451 Cannot delete or update a parent row: a foreign key constraint fails
Note 1051 Unknown table 'test.t0'
drop table t2,t1;
create table t3 (a int) engine=aria;
drop table t10,t20;
ERROR 42S02: Unknown table 'test.t10,test.t20'
drop table t10,t20,t3;
ERROR 42S02: Unknown table 'test.t10,test.t20'
drop table if exists t10,t20;
Warnings:
Note 1051 Unknown table 'test.t10,test.t20'
drop table if exists t10,t20,t3;
Warnings:
Note 1051 Unknown table 'test.t10,test.t20,test.t3'
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`; create table t1 (a int, key(a)) engine=InnoDB
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; create table t2 (b int, foreign key(b) references t1(a)) engine=InnoDB
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `t0` /* generated by server */
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TABLE `t2`,`t1` /* generated by server */
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; create table t3 (a int) engine=aria
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TABLE `t10`,`t20`,`t3` /* generated by server */
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `t10`,`t20` /* generated by server */
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `t10`,`t20`,`t3` /* generated by server */