1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +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

@ -8,6 +8,9 @@ Tables_in_test
#
drop table t1,t2,t3;
ERROR 42S02: Unknown table 'test.t3'
show warnings;
Level Code Message
Error 1051 Unknown table 'test.t3'
show tables;
Tables_in_test
s1
@ -17,6 +20,9 @@ v2
# Generating test tables
drop table t1,t3,t2;
ERROR 42S02: Unknown table 'test.t3'
show warnings;
Level Code Message
Error 1051 Unknown table 'test.t3'
show tables;
Tables_in_test
s1
@ -26,6 +32,9 @@ v2
# Generating test tables
drop table t1,t4,t2,t3;
ERROR 42S02: Unknown table 'test.t4,test.t3'
show warnings;
Level Code Message
Error 1051 Unknown table 'test.t4,test.t3'
show tables;
Tables_in_test
s1
@ -40,7 +49,11 @@ v1
v2
# Generating test tables
drop table t1,v1,v2,t2;
ERROR 42S02: Unknown table 'test.v1,test.v2'
ERROR 42S02: 'test.v1' is a view
show warnings;
Level Code Message
Error 1965 'test.v1' is a view
Error 1965 'test.v2' is a view
show tables;
Tables_in_test
s1
@ -49,7 +62,11 @@ v1
v2
# Generating test tables
drop table v1,s1,s2,v2,t2;
ERROR 42S02: Unknown table 'test.v1,test.v2'
ERROR 42S02: 'test.v1' is a view
show warnings;
Level Code Message
Error 1965 'test.v1' is a view
Error 1965 'test.v2' is a view
show tables;
Tables_in_test
t1
@ -57,16 +74,29 @@ v1
v2
# Generating test tables
drop table t1,s1,v1,t3,t4;
ERROR 42S02: Unknown table 'test.v1,test.t3,test.t4'
ERROR 42S02: 'test.v1' is a view
show warnings;
Level Code Message
Warning 1017 Can't find file: './test/t1.MYI' (errno: 2 "No such file or directory")
Error 1965 'test.v1' is a view
Error 1051 Unknown table 'test.t3,test.t4'
drop table s2,v2,t2,t1;
ERROR 42S02: Unknown table 'test.v2,test.t1'
ERROR 42S02: 'test.v2' is a view
show warnings;
Level Code Message
Error 1965 'test.v2' is a view
Error 1051 Unknown table 'test.t1'
show tables;
Tables_in_test
v1
v2
# Generating test tables
drop table s1,v1,s2,v2;
ERROR 42S02: Unknown table 'test.v1,test.v2'
ERROR 42S02: 'test.v1' is a view
show warnings;
Level Code Message
Error 1965 'test.v1' is a view
Error 1965 'test.v2' is a view
show tables;
Tables_in_test
t1
@ -99,8 +129,7 @@ v2
# Generating test tables
drop table if exists t1,t4,t2,t3;
Warnings:
Note 1051 Unknown table 'test.t4'
Note 1051 Unknown table 'test.t3'
Note 1051 Unknown table 'test.t4,test.t3'
show tables;
Tables_in_test
s1
@ -116,8 +145,8 @@ v2
# Generating test tables
drop table if exists t1,v1,v2,t2;
Warnings:
Note 1051 Unknown table 'test.v1'
Note 1051 Unknown table 'test.v2'
Note 1965 'test.v1' is a view
Note 1965 'test.v2' is a view
show tables;
Tables_in_test
s1
@ -127,8 +156,8 @@ v2
# Generating test tables
drop table if exists v1,s1,s2,v2,t2;
Warnings:
Note 1051 Unknown table 'test.v1'
Note 1051 Unknown table 'test.v2'
Note 1965 'test.v1' is a view
Note 1965 'test.v2' is a view
show tables;
Tables_in_test
t1
@ -138,12 +167,12 @@ v2
drop table if exists t1,s1,v1,t3,t4;
Warnings:
Warning 1017 Can't find file: './test/t1.MYI' (errno: 2 "No such file or directory")
Note 1051 Unknown table 'test.v1'
Note 1051 Unknown table 'test.t3'
Note 1051 Unknown table 'test.t4'
Note 1965 'test.v1' is a view
Note 1965 'test.t3' is a view
Note 1965 'test.t4' is a view
drop table if exists s2,v2,t2,t1;
Warnings:
Note 1051 Unknown table 'test.v2'
Note 1965 'test.v2' is a view
Note 1051 Unknown table 'test.t1'
show tables;
Tables_in_test
@ -152,8 +181,8 @@ v2
# Generating test tables
drop table if exists s1,v1,s2,v2;
Warnings:
Note 1051 Unknown table 'test.v1'
Note 1051 Unknown table 'test.v2'
Note 1965 'test.v1' is a view
Note 1965 'test.v2' is a view
show tables;
Tables_in_test
t1
@ -171,29 +200,53 @@ drop temporary sequence if exists ss1,ss2;
drop view if exists v1,v2;
drop temporary table t1,t2,t3;
ERROR 42S02: Unknown table 'test.t1,test.t2,test.t3'
show warnings;
Level Code Message
Error 1051 Unknown table 'test.t1,test.t2,test.t3'
# Generating test tables
drop temporary table t1,t3,t2;
ERROR 42S02: Unknown table 'test.t3'
show warnings;
Level Code Message
Error 1051 Unknown table 'test.t3'
# Generating test tables
drop temporary table t1,t4,t2,t3;
ERROR 42S02: Unknown table 'test.t4,test.t3'
show warnings;
Level Code Message
Error 1051 Unknown table 'test.t4,test.t3'
# Generating test tables
drop temporary table t1,s1,s2,t2;
# Generating test tables
drop temporary table t1,v1,v2,t2;
ERROR 42S02: Unknown table 'test.v1,test.v2'
show warnings;
Level Code Message
Error 1051 Unknown table 'test.v1,test.v2'
# Generating test tables
drop temporary table v1,s1,s2,v2,t2;
ERROR 42S02: Unknown table 'test.v1,test.v2'
show warnings;
Level Code Message
Error 1051 Unknown table 'test.v1,test.v2'
# Generating test tables
drop temporary table t1,s1,v1,t3,t4;
ERROR 42S02: Unknown table 'test.v1,test.t3,test.t4'
show warnings;
Level Code Message
Error 1051 Unknown table 'test.v1,test.t3,test.t4'
# Generating test tables
drop temporary table s2,v2,t2,t1;
ERROR 42S02: Unknown table 'test.v2'
show warnings;
Level Code Message
Error 1051 Unknown table 'test.v2'
# Generating test tables
drop temporary table s1,v1,s2,v2;
ERROR 42S02: Unknown table 'test.v1,test.v2'
show warnings;
Level Code Message
Error 1051 Unknown table 'test.v1,test.v2'
# Generating test tables
#
# DROP TEMPORARY TABLE with if exists
@ -208,35 +261,28 @@ Note 1051 Unknown table 'test.t3'
# Generating test tables
drop temporary table if exists t1,t4,t2,t3;
Warnings:
Note 1051 Unknown table 'test.t4'
Note 1051 Unknown table 'test.t3'
Note 1051 Unknown table 'test.t4,test.t3'
# Generating test tables
drop temporary table if exists t1,s1,s2,t2;
# Generating test tables
drop temporary table if exists t1,v1,v2,t2;
Warnings:
Note 1051 Unknown table 'test.v1'
Note 1051 Unknown table 'test.v2'
Note 1051 Unknown table 'test.v1,test.v2'
# Generating test tables
drop temporary table if exists v1,s1,s2,v2,t2;
Warnings:
Note 1051 Unknown table 'test.v1'
Note 1051 Unknown table 'test.v2'
Note 1051 Unknown table 'test.v1,test.v2'
# Generating test tables
drop temporary table if exists t1,s1,v1,t3,t4;
Warnings:
Note 1051 Unknown table 'test.v1'
Note 1051 Unknown table 'test.t3'
Note 1051 Unknown table 'test.t4'
Note 1051 Unknown table 'test.v1,test.t3,test.t4'
drop temporary table if exists s2,v2,t2,t1;
Warnings:
Note 1051 Unknown table 'test.v2'
Note 1051 Unknown table 'test.t1'
Note 1051 Unknown table 'test.v2,test.t1'
# Generating test tables
drop temporary table if exists s1,v1,s2,v2;
Warnings:
Note 1051 Unknown table 'test.v1'
Note 1051 Unknown table 'test.v2'
Note 1051 Unknown table 'test.v1,test.v2'
# Generating test tables
drop temporary table t1,t2;
drop temporary sequence s1,s2;
@ -248,6 +294,9 @@ Tables_in_test
#
drop sequence s1,s2,s3;
ERROR 42S02: Unknown SEQUENCE: 'test.s3'
show warnings;
Level Code Message
Error 4091 Unknown SEQUENCE: 'test.s3'
show tables;
Tables_in_test
t1
@ -257,6 +306,9 @@ v2
# Generating test tables
drop sequence s1,s3,s2;
ERROR 42S02: Unknown SEQUENCE: 'test.s3'
show warnings;
Level Code Message
Error 4091 Unknown SEQUENCE: 'test.s3'
show tables;
Tables_in_test
t1
@ -266,6 +318,9 @@ v2
# Generating test tables
drop sequence s1,s4,s2,s3;
ERROR 42S02: Unknown SEQUENCE: 'test.s4,test.s3'
show warnings;
Level Code Message
Error 4091 Unknown SEQUENCE: 'test.s4,test.s3'
show tables;
Tables_in_test
t1
@ -273,8 +328,13 @@ t2
v1
v2
# Generating test tables
drop sequence s1,t1,t2,s2;
ERROR 42S02: Unknown SEQUENCE: 'test.t1,test.t2'
drop sequence s1,t1,t2,s2,s3,s4;
ERROR 42S02: 'test.t1' is not a SEQUENCE
show warnings;
Level Code Message
Error 4090 'test.t1' is not a SEQUENCE
Error 4090 'test.t2' is not a SEQUENCE
Error 4091 Unknown SEQUENCE: 'test.s3,test.s4'
show tables;
Tables_in_test
t1
@ -283,7 +343,11 @@ v1
v2
# Generating test tables
drop sequence s1,v1,v2,s2;
ERROR 42S02: Unknown SEQUENCE: 'test.v1,test.v2'
ERROR 42S02: 'test.v1' is a view
show warnings;
Level Code Message
Error 1965 'test.v1' is a view
Error 1965 'test.v2' is a view
show tables;
Tables_in_test
t1
@ -292,7 +356,22 @@ v1
v2
# Generating test tables
drop sequence v1,t1,t2,v2,s2;
ERROR 42S02: Unknown SEQUENCE: 'test.v1,test.t1,test.t2,test.v2'
ERROR 42S02: 'test.v1' is a view
show warnings;
Level Code Message
Error 1965 'test.v1' is a view
Error 4090 'test.t1' is not a SEQUENCE
Error 4090 'test.t2' is not a SEQUENCE
Error 1965 'test.v2' is a view
drop sequence t1,v1,t2,v2,s2;
ERROR 42S02: 'test.t1' is not a SEQUENCE
show warnings;
Level Code Message
Error 4090 'test.t1' is not a SEQUENCE
Error 1965 'test.v1' is a view
Error 4090 'test.t2' is not a SEQUENCE
Error 1965 'test.v2' is a view
Error 4091 Unknown SEQUENCE: 'test.s2'
show tables;
Tables_in_test
s1
@ -302,9 +381,20 @@ v1
v2
# Generating test tables
drop sequence s1,t1,v1,t3,s4;
ERROR 42S02: Unknown SEQUENCE: 'test.t1,test.v1,test.t3,test.s4'
ERROR 42S02: 'test.t1' is not a SEQUENCE
show warnings;
Level Code Message
Warning 1017 Can't find file: './test/s1.MYI' (errno: 2 "No such file or directory")
Error 4090 'test.t1' is not a SEQUENCE
Error 1965 'test.v1' is a view
Error 4091 Unknown SEQUENCE: 'test.t3,test.s4'
drop sequence t2,v2,s2,s1;
ERROR 42S02: Unknown SEQUENCE: 'test.t2,test.v2,test.s1'
ERROR 42S02: 'test.t2' is not a SEQUENCE
show warnings;
Level Code Message
Error 4090 'test.t2' is not a SEQUENCE
Error 1965 'test.v2' is a view
Error 4091 Unknown SEQUENCE: 'test.s1'
show tables;
Tables_in_test
t1
@ -313,7 +403,13 @@ v1
v2
# Generating test tables
drop sequence t1,v1,t2,v2;
ERROR 42S02: Unknown SEQUENCE: 'test.t1,test.v1,test.t2,test.v2'
ERROR 42S02: 'test.t1' is not a SEQUENCE
show warnings;
Level Code Message
Error 4090 'test.t1' is not a SEQUENCE
Error 1965 'test.v1' is a view
Error 4090 'test.t2' is not a SEQUENCE
Error 1965 'test.v2' is a view
show tables;
Tables_in_test
s1
@ -348,8 +444,7 @@ v2
# Generating test tables
drop sequence if exists s1,s4,s2,s3;
Warnings:
Note 4091 Unknown SEQUENCE: 'test.s4'
Note 4091 Unknown SEQUENCE: 'test.s3'
Note 4091 Unknown SEQUENCE: 'test.s4,test.s3'
show tables;
Tables_in_test
t1
@ -359,8 +454,8 @@ v2
# Generating test tables
drop sequence if exists s1,t1,t2,s2;
Warnings:
Note 4091 Unknown SEQUENCE: 'test.t1'
Note 4091 Unknown SEQUENCE: 'test.t2'
Note 4090 'test.t1' is not a SEQUENCE
Note 4090 'test.t2' is not a SEQUENCE
show tables;
Tables_in_test
t1
@ -370,8 +465,8 @@ v2
# Generating test tables
drop sequence if exists s1,v1,v2,s2;
Warnings:
Note 4091 Unknown SEQUENCE: 'test.v1'
Note 4091 Unknown SEQUENCE: 'test.v2'
Note 1965 'test.v1' is a view
Note 1965 'test.v2' is a view
show tables;
Tables_in_test
t1
@ -381,10 +476,10 @@ v2
# Generating test tables
drop sequence if exists v1,t1,t2,v2,s2;
Warnings:
Note 4091 Unknown SEQUENCE: 'test.v1'
Note 4091 Unknown SEQUENCE: 'test.t1'
Note 4091 Unknown SEQUENCE: 'test.t2'
Note 4091 Unknown SEQUENCE: 'test.v2'
Note 1965 'test.v1' is a view
Note 4090 'test.t1' is not a SEQUENCE
Note 4090 'test.t2' is not a SEQUENCE
Note 1965 'test.v2' is a view
show tables;
Tables_in_test
s1
@ -396,14 +491,14 @@ v2
drop sequence if exists s1,t1,v1,t3,s4;
Warnings:
Warning 1017 Can't find file: './test/s1.MYI' (errno: 2 "No such file or directory")
Note 4091 Unknown SEQUENCE: 'test.t1'
Note 4091 Unknown SEQUENCE: 'test.v1'
Note 4091 Unknown SEQUENCE: 'test.t3'
Note 4091 Unknown SEQUENCE: 'test.s4'
Note 4090 'test.t1' is not a SEQUENCE
Note 1965 'test.v1' is a view
Note 1965 'test.t3' is a view
Note 1965 'test.s4' is a view
drop sequence if exists t2,v2,s2,s1;
Warnings:
Note 4091 Unknown SEQUENCE: 'test.t2'
Note 4091 Unknown SEQUENCE: 'test.v2'
Note 4090 'test.t2' is not a SEQUENCE
Note 1965 'test.v2' is a view
Note 4091 Unknown SEQUENCE: 'test.s1'
show tables;
Tables_in_test
@ -414,10 +509,10 @@ v2
# Generating test tables
drop sequence if exists t1,v1,t2,v2;
Warnings:
Note 4091 Unknown SEQUENCE: 'test.t1'
Note 4091 Unknown SEQUENCE: 'test.v1'
Note 4091 Unknown SEQUENCE: 'test.t2'
Note 4091 Unknown SEQUENCE: 'test.v2'
Note 4090 'test.t1' is not a SEQUENCE
Note 1965 'test.v1' is a view
Note 4090 'test.t2' is not a SEQUENCE
Note 1965 'test.v2' is a view
show tables;
Tables_in_test
s1
@ -438,29 +533,56 @@ drop view if exists v1,v2;
# Generating test tables
drop temporary sequence s1,s2,s3;
ERROR 42S02: Unknown SEQUENCE: 'test.s3'
show warnings;
Level Code Message
Error 4091 Unknown SEQUENCE: 'test.s3'
# Generating test tables
drop temporary sequence s1,s3,s2;
ERROR 42S02: Unknown SEQUENCE: 'test.s3'
show warnings;
Level Code Message
Error 4091 Unknown SEQUENCE: 'test.s3'
# Generating test tables
drop temporary sequence s1,s4,s2,s3;
ERROR 42S02: Unknown SEQUENCE: 'test.s4,test.s3'
show warnings;
Level Code Message
Error 4091 Unknown SEQUENCE: 'test.s4,test.s3'
# Generating test tables
drop temporary sequence s1,t1,t2,s2;
ERROR 42S02: Unknown SEQUENCE: 'test.t1,test.t2'
show warnings;
Level Code Message
Error 4091 Unknown SEQUENCE: 'test.t1,test.t2'
# Generating test tables
drop temporary sequence s1,v1,v2,s2;
ERROR 42S02: Unknown SEQUENCE: 'test.v1,test.v2'
show warnings;
Level Code Message
Error 4091 Unknown SEQUENCE: 'test.v1,test.v2'
# Generating test tables
drop temporary sequence v1,t1,t2,v2,s2;
ERROR 42S02: Unknown SEQUENCE: 'test.v1,test.t1,test.t2,test.v2'
show warnings;
Level Code Message
Error 4091 Unknown SEQUENCE: 'test.v1,test.t1,test.t2,test.v2'
# Generating test tables
drop temporary sequence s1,t1,v1,t3,s4;
ERROR 42S02: Unknown SEQUENCE: 'test.t1,test.v1,test.t3,test.s4'
show warnings;
Level Code Message
Error 4091 Unknown SEQUENCE: 'test.t1,test.v1,test.t3,test.s4'
drop temporary sequence t2,v2,s2,s1;
ERROR 42S02: Unknown SEQUENCE: 'test.t2,test.v2,test.s1'
show warnings;
Level Code Message
Error 4091 Unknown SEQUENCE: 'test.t2,test.v2,test.s1'
# Generating test tables
drop temporary sequence t1,v1,t2,v2;
ERROR 42S02: Unknown SEQUENCE: 'test.t1,test.v1,test.t2,test.v2'
show warnings;
Level Code Message
Error 4091 Unknown SEQUENCE: 'test.t1,test.v1,test.t2,test.v2'
# Generating test tables
#
# DROP TEMPORARY SEQUENCE with if exists
@ -475,44 +597,30 @@ Note 4091 Unknown SEQUENCE: 'test.s3'
# Generating test tables
drop temporary sequence if exists s1,s4,s2,s3;
Warnings:
Note 4091 Unknown SEQUENCE: 'test.s4'
Note 4091 Unknown SEQUENCE: 'test.s3'
Note 4091 Unknown SEQUENCE: 'test.s4,test.s3'
# Generating test tables
drop temporary sequence if exists s1,t1,t2,s2;
Warnings:
Note 4091 Unknown SEQUENCE: 'test.t1'
Note 4091 Unknown SEQUENCE: 'test.t2'
Note 4091 Unknown SEQUENCE: 'test.t1,test.t2'
# Generating test tables
drop temporary sequence if exists s1,v1,v2,s2;
Warnings:
Note 4091 Unknown SEQUENCE: 'test.v1'
Note 4091 Unknown SEQUENCE: 'test.v2'
Note 4091 Unknown SEQUENCE: 'test.v1,test.v2'
# Generating test tables
drop temporary sequence if exists v1,t1,t2,v2,s2;
Warnings:
Note 4091 Unknown SEQUENCE: 'test.v1'
Note 4091 Unknown SEQUENCE: 'test.t1'
Note 4091 Unknown SEQUENCE: 'test.t2'
Note 4091 Unknown SEQUENCE: 'test.v2'
Note 4091 Unknown SEQUENCE: 'test.v1,test.t1,test.t2,test.v2'
# Generating test tables
drop temporary sequence if exists s1,t1,v1,t3,s4;
Warnings:
Note 4091 Unknown SEQUENCE: 'test.t1'
Note 4091 Unknown SEQUENCE: 'test.v1'
Note 4091 Unknown SEQUENCE: 'test.t3'
Note 4091 Unknown SEQUENCE: 'test.s4'
Note 4091 Unknown SEQUENCE: 'test.t1,test.v1,test.t3,test.s4'
drop temporary sequence if exists t2,v2,s2,s1;
Warnings:
Note 4091 Unknown SEQUENCE: 'test.t2'
Note 4091 Unknown SEQUENCE: 'test.v2'
Note 4091 Unknown SEQUENCE: 'test.s1'
Note 4091 Unknown SEQUENCE: 'test.t2,test.v2,test.s1'
# Generating test tables
drop temporary sequence if exists t1,v1,t2,v2;
Warnings:
Note 4091 Unknown SEQUENCE: 'test.t1'
Note 4091 Unknown SEQUENCE: 'test.v1'
Note 4091 Unknown SEQUENCE: 'test.t2'
Note 4091 Unknown SEQUENCE: 'test.v2'
Note 4091 Unknown SEQUENCE: 'test.t1,test.v1,test.t2,test.v2'
# Generating test tables
drop temporary table t1,t2;
drop temporary sequence s1,s2;