Skip to content

Commit

Permalink
Fixed error messages from DROP VIEW to align with DROP TABLE
Browse files Browse the repository at this point in the history
- Produce a "Note" for all wrongly dropped objects
  (Like doing DROP VIEW on a table).
- IF EXISTS ends with a list of all not existing objects, instead of a
  separate note for every not existing object.

Other things:
 - Fixed bug where one could do CREATE TEMPORARY SEQUENCE multiple times
   and create multiple temporary sequences with the same name.
  • Loading branch information
montywi committed Jun 14, 2020
1 parent 5bcb1d6 commit 346d10a
Show file tree
Hide file tree
Showing 8 changed files with 1,150 additions and 37 deletions.
1 change: 1 addition & 0 deletions mysql-test/main/create_drop_view.result
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,6 @@ Warnings:
Note 4092 Unknown VIEW: 'test.v1'
DROP VIEW IF EXISTS t1;
Warnings:
Warning 1347 'test.t1' is not of type 'VIEW'
Note 4092 Unknown VIEW: 'test.t1'
DROP TABLE t1;
5 changes: 1 addition & 4 deletions mysql-test/main/drop.result
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,7 @@ Note 1051 Unknown table 'test.table1'
Note 1051 Unknown table 'test.table2'
DROP VIEW IF EXISTS view1,view2,view3,view4;
Warnings:
Note 4092 Unknown VIEW: 'test.view1'
Note 4092 Unknown VIEW: 'test.view2'
Note 4092 Unknown VIEW: 'test.view3'
Note 4092 Unknown VIEW: 'test.view4'
Note 4092 Unknown VIEW: 'test.view1,test.view2,test.view3,test.view4'

# Test error message when trigger does not find table
CREATE TABLE table1(a int);
Expand Down
24 changes: 24 additions & 0 deletions mysql-test/main/drop_combinations.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#
# Create all tables, sequences and views needed for drop combinations;
#

if ($create_option != 'temporary')
{
show tables;
}

--echo # Generating test tables
--disable_query_log
--disable_warnings
eval create $create_option table if not exists t1 (a int);
eval create $create_option table if not exists t2 (a int);
eval create $create_option sequence if not exists s1;
eval create $create_option sequence if not exists s2;
if ($create_option != 'temporary')
{
eval create view if not exists v1 as SELECT * from t1;
eval create view if not exists v2 as SELECT * from t2;
}

--enable_warnings
--enable_query_log
Loading

0 comments on commit 346d10a

Please sign in to comment.