Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
47f43867
Commit
47f43867
authored
Mar 20, 2014
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-5894 MySQL BUG#34750: Print database name in Unknown Table error message
parent
9418bd9c
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
102 additions
and
22 deletions
+102
-22
mysql-test/r/drop.result
mysql-test/r/drop.result
+36
-0
mysql-test/r/trigger.result
mysql-test/r/trigger.result
+1
-1
mysql-test/r/view.result
mysql-test/r/view.result
+2
-2
mysql-test/suite/funcs_1/r/innodb_views.result
mysql-test/suite/funcs_1/r/innodb_views.result
+7
-7
mysql-test/suite/funcs_1/r/memory_views.result
mysql-test/suite/funcs_1/r/memory_views.result
+7
-7
mysql-test/suite/rpl/r/rpl_drop_view.result
mysql-test/suite/rpl/r/rpl_drop_view.result
+2
-2
mysql-test/t/drop.test
mysql-test/t/drop.test
+37
-0
sql/sql_base.cc
sql/sql_base.cc
+9
-2
sql/sql_view.cc
sql/sql_view.cc
+1
-1
No files found.
mysql-test/r/drop.result
View file @
47f43867
...
@@ -173,3 +173,39 @@ DROP TABLE t1, t1;
...
@@ -173,3 +173,39 @@ DROP TABLE t1, t1;
ERROR 42000: Not unique table/alias: 't1'
ERROR 42000: Not unique table/alias: 't1'
UNLOCK TABLES;
UNLOCK TABLES;
DROP TABLE t1;
DROP TABLE t1;
#
# BUG#34750: Print database name in Unknown Table error message
#
# Test error message when droping table/view
DROP TABLE table1;
ERROR 42S02: Unknown table 'test.table1'
DROP TABLE table1,table2;
ERROR 42S02: Unknown table 'test.table1,test.table2'
DROP VIEW view1,view2,view3,view4;
ERROR 42S02: Unknown table 'test.view1,test.view2,test.view3,test.view4'
DROP TABLE IF EXISTS table1;
Warnings:
Note 1051 Unknown table 'test.table1'
DROP TABLE IF EXISTS table1,table2;
Warnings:
Note 1051 Unknown table 'test.table1'
Note 1051 Unknown table 'test.table2'
DROP VIEW IF EXISTS view1,view2,view3,view4;
Warnings:
Note 1051 Unknown table 'test.view1'
Note 1051 Unknown table 'test.view2'
Note 1051 Unknown table 'test.view3'
Note 1051 Unknown table 'test.view4'
# Test error message when trigger does not find table
CREATE TABLE table1(a int);
CREATE TABLE table2(b int);
CREATE TRIGGER trg1 AFTER INSERT ON table1
FOR EACH ROW
INSERT INTO table2 SELECT t.notable.*;
INSERT INTO table1 VALUES (1);
ERROR 42S02: Unknown table 't.notable'
DROP TABLE table1,table2;
# End BUG#34750
mysql-test/r/trigger.result
View file @
47f43867
...
@@ -1944,7 +1944,7 @@ insert into table_25411_b select new.*;
...
@@ -1944,7 +1944,7 @@ insert into table_25411_b select new.*;
select * from table_25411_a;
select * from table_25411_a;
a
a
insert into table_25411_a values (1);
insert into table_25411_a values (1);
ERROR 42S02: Unknown table 'new'
ERROR 42S02: Unknown table '
test.
new'
select * from table_25411_a;
select * from table_25411_a;
a
a
1
1
...
...
mysql-test/r/view.result
View file @
47f43867
...
@@ -201,7 +201,7 @@ c d
...
@@ -201,7 +201,7 @@ c d
2 5
2 5
3 10
3 10
drop view v100;
drop view v100;
ERROR 42S02: Unknown table 'v100'
ERROR 42S02: Unknown table '
test.
v100'
drop view t1;
drop view t1;
ERROR HY000: 'test.t1' is not VIEW
ERROR HY000: 'test.t1' is not VIEW
drop table v1;
drop table v1;
...
@@ -2872,7 +2872,7 @@ Tables_in_test
...
@@ -2872,7 +2872,7 @@ Tables_in_test
t1
t1
v1
v1
DROP VIEW v2,v1;
DROP VIEW v2,v1;
ERROR 42S02: Unknown table 'v2'
ERROR 42S02: Unknown table '
test.
v2'
SHOW TABLES;
SHOW TABLES;
Tables_in_test
Tables_in_test
t1
t1
...
...
mysql-test/suite/funcs_1/r/innodb_views.result
View file @
47f43867
...
@@ -21307,7 +21307,7 @@ CREATE TABLE t1 ( f1 VARCHAR(1000) ) ENGINE = innodb ;
...
@@ -21307,7 +21307,7 @@ CREATE TABLE t1 ( f1 VARCHAR(1000) ) ENGINE = innodb ;
CREATE VIEW v1 AS SELECT f1 FROM t1;
CREATE VIEW v1 AS SELECT f1 FROM t1;
DROP VIEW v1;
DROP VIEW v1;
DROP VIEW v1;
DROP VIEW v1;
ERROR 42S02: Unknown table 'v1'
ERROR 42S02: Unknown table '
test.
v1'
CREATE VIEW v1 AS SELECT f1 FROM t1;
CREATE VIEW v1 AS SELECT f1 FROM t1;
DROP VIEW IF EXISTS v1;
DROP VIEW IF EXISTS v1;
DROP VIEW IF EXISTS v1;
DROP VIEW IF EXISTS v1;
...
@@ -21324,31 +21324,31 @@ CREATE VIEW v1_base AS SELECT * FROM t1;
...
@@ -21324,31 +21324,31 @@ CREATE VIEW v1_base AS SELECT * FROM t1;
CREATE VIEW v1_top AS SELECT * FROM v1_base;
CREATE VIEW v1_top AS SELECT * FROM v1_base;
DROP VIEW v1_top ;
DROP VIEW v1_top ;
DROP VIEW v1_top;
DROP VIEW v1_top;
ERROR 42S02: Unknown table 'v1_top'
ERROR 42S02: Unknown table '
test.
v1_top'
CREATE VIEW v1_top AS SELECT * FROM v1_base;
CREATE VIEW v1_top AS SELECT * FROM v1_base;
DROP VIEW v1_base ;
DROP VIEW v1_base ;
DROP VIEW v1_base;
DROP VIEW v1_base;
ERROR 42S02: Unknown table 'v1_base'
ERROR 42S02: Unknown table '
test.
v1_base'
DROP VIEW v1_top;
DROP VIEW v1_top;
CREATE VIEW v1_base AS SELECT * FROM t1;
CREATE VIEW v1_base AS SELECT * FROM t1;
CREATE VIEW v1_top AS SELECT * FROM v1_base;
CREATE VIEW v1_top AS SELECT * FROM v1_base;
DROP VIEW v1_top CASCADE ;
DROP VIEW v1_top CASCADE ;
DROP VIEW v1_top;
DROP VIEW v1_top;
ERROR 42S02: Unknown table 'v1_top'
ERROR 42S02: Unknown table '
test.
v1_top'
CREATE VIEW v1_top AS SELECT * FROM v1_base;
CREATE VIEW v1_top AS SELECT * FROM v1_base;
DROP VIEW v1_base CASCADE ;
DROP VIEW v1_base CASCADE ;
DROP VIEW v1_base;
DROP VIEW v1_base;
ERROR 42S02: Unknown table 'v1_base'
ERROR 42S02: Unknown table '
test.
v1_base'
DROP VIEW v1_top;
DROP VIEW v1_top;
CREATE VIEW v1_base AS SELECT * FROM t1;
CREATE VIEW v1_base AS SELECT * FROM t1;
CREATE VIEW v1_top AS SELECT * FROM v1_base;
CREATE VIEW v1_top AS SELECT * FROM v1_base;
DROP VIEW v1_top RESTRICT ;
DROP VIEW v1_top RESTRICT ;
DROP VIEW v1_top;
DROP VIEW v1_top;
ERROR 42S02: Unknown table 'v1_top'
ERROR 42S02: Unknown table '
test.
v1_top'
CREATE VIEW v1_top AS SELECT * FROM v1_base;
CREATE VIEW v1_top AS SELECT * FROM v1_base;
DROP VIEW v1_base RESTRICT ;
DROP VIEW v1_base RESTRICT ;
DROP VIEW v1_base;
DROP VIEW v1_base;
ERROR 42S02: Unknown table 'v1_base'
ERROR 42S02: Unknown table '
test.
v1_base'
DROP VIEW v1_top;
DROP VIEW v1_top;
Testcase 3.3.1.69, 3.3.1.70, 3.3.1.A5
Testcase 3.3.1.69, 3.3.1.70, 3.3.1.A5
...
...
mysql-test/suite/funcs_1/r/memory_views.result
View file @
47f43867
...
@@ -21309,7 +21309,7 @@ CREATE TABLE t1 ( f1 VARCHAR(1000) ) ENGINE = memory ;
...
@@ -21309,7 +21309,7 @@ CREATE TABLE t1 ( f1 VARCHAR(1000) ) ENGINE = memory ;
CREATE VIEW v1 AS SELECT f1 FROM t1;
CREATE VIEW v1 AS SELECT f1 FROM t1;
DROP VIEW v1;
DROP VIEW v1;
DROP VIEW v1;
DROP VIEW v1;
ERROR 42S02: Unknown table 'v1'
ERROR 42S02: Unknown table '
test.
v1'
CREATE VIEW v1 AS SELECT f1 FROM t1;
CREATE VIEW v1 AS SELECT f1 FROM t1;
DROP VIEW IF EXISTS v1;
DROP VIEW IF EXISTS v1;
DROP VIEW IF EXISTS v1;
DROP VIEW IF EXISTS v1;
...
@@ -21326,31 +21326,31 @@ CREATE VIEW v1_base AS SELECT * FROM t1;
...
@@ -21326,31 +21326,31 @@ CREATE VIEW v1_base AS SELECT * FROM t1;
CREATE VIEW v1_top AS SELECT * FROM v1_base;
CREATE VIEW v1_top AS SELECT * FROM v1_base;
DROP VIEW v1_top ;
DROP VIEW v1_top ;
DROP VIEW v1_top;
DROP VIEW v1_top;
ERROR 42S02: Unknown table 'v1_top'
ERROR 42S02: Unknown table '
test.
v1_top'
CREATE VIEW v1_top AS SELECT * FROM v1_base;
CREATE VIEW v1_top AS SELECT * FROM v1_base;
DROP VIEW v1_base ;
DROP VIEW v1_base ;
DROP VIEW v1_base;
DROP VIEW v1_base;
ERROR 42S02: Unknown table 'v1_base'
ERROR 42S02: Unknown table '
test.
v1_base'
DROP VIEW v1_top;
DROP VIEW v1_top;
CREATE VIEW v1_base AS SELECT * FROM t1;
CREATE VIEW v1_base AS SELECT * FROM t1;
CREATE VIEW v1_top AS SELECT * FROM v1_base;
CREATE VIEW v1_top AS SELECT * FROM v1_base;
DROP VIEW v1_top CASCADE ;
DROP VIEW v1_top CASCADE ;
DROP VIEW v1_top;
DROP VIEW v1_top;
ERROR 42S02: Unknown table 'v1_top'
ERROR 42S02: Unknown table '
test.
v1_top'
CREATE VIEW v1_top AS SELECT * FROM v1_base;
CREATE VIEW v1_top AS SELECT * FROM v1_base;
DROP VIEW v1_base CASCADE ;
DROP VIEW v1_base CASCADE ;
DROP VIEW v1_base;
DROP VIEW v1_base;
ERROR 42S02: Unknown table 'v1_base'
ERROR 42S02: Unknown table '
test.
v1_base'
DROP VIEW v1_top;
DROP VIEW v1_top;
CREATE VIEW v1_base AS SELECT * FROM t1;
CREATE VIEW v1_base AS SELECT * FROM t1;
CREATE VIEW v1_top AS SELECT * FROM v1_base;
CREATE VIEW v1_top AS SELECT * FROM v1_base;
DROP VIEW v1_top RESTRICT ;
DROP VIEW v1_top RESTRICT ;
DROP VIEW v1_top;
DROP VIEW v1_top;
ERROR 42S02: Unknown table 'v1_top'
ERROR 42S02: Unknown table '
test.
v1_top'
CREATE VIEW v1_top AS SELECT * FROM v1_base;
CREATE VIEW v1_top AS SELECT * FROM v1_base;
DROP VIEW v1_base RESTRICT ;
DROP VIEW v1_base RESTRICT ;
DROP VIEW v1_base;
DROP VIEW v1_base;
ERROR 42S02: Unknown table 'v1_base'
ERROR 42S02: Unknown table '
test.
v1_base'
DROP VIEW v1_top;
DROP VIEW v1_top;
Testcase 3.3.1.69, 3.3.1.70, 3.3.1.A5
Testcase 3.3.1.69, 3.3.1.70, 3.3.1.A5
...
...
mysql-test/suite/rpl/r/rpl_drop_view.result
View file @
47f43867
...
@@ -9,9 +9,9 @@ create view v1 as select * from t1;
...
@@ -9,9 +9,9 @@ create view v1 as select * from t1;
create view v2 as select * from t2;
create view v2 as select * from t2;
create view v3 as select * from t3;
create view v3 as select * from t3;
drop view not_exist_view;
drop view not_exist_view;
ERROR 42S02: Unknown table 'not_exist_view'
ERROR 42S02: Unknown table '
test.
not_exist_view'
drop view v1, not_exist_view;
drop view v1, not_exist_view;
ERROR 42S02: Unknown table 'not_exist_view'
ERROR 42S02: Unknown table '
test.
not_exist_view'
select * from v1;
select * from v1;
ERROR 42S02: Table 'test.v1' doesn't exist
ERROR 42S02: Table 'test.v1' doesn't exist
drop view v2, v3;
drop view v2, v3;
...
...
mysql-test/t/drop.test
View file @
47f43867
...
@@ -276,3 +276,40 @@ DROP TABLE t1, t1;
...
@@ -276,3 +276,40 @@ DROP TABLE t1, t1;
UNLOCK
TABLES
;
UNLOCK
TABLES
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
--
echo
#
--
echo
# BUG#34750: Print database name in Unknown Table error message
--
echo
#
--
echo
--
echo
# Test error message when droping table/view
--
error
ER_BAD_TABLE_ERROR
DROP
TABLE
table1
;
--
error
ER_BAD_TABLE_ERROR
DROP
TABLE
table1
,
table2
;
--
error
ER_BAD_TABLE_ERROR
DROP
VIEW
view1
,
view2
,
view3
,
view4
;
--
echo
DROP
TABLE
IF
EXISTS
table1
;
DROP
TABLE
IF
EXISTS
table1
,
table2
;
DROP
VIEW
IF
EXISTS
view1
,
view2
,
view3
,
view4
;
--
echo
--
echo
# Test error message when trigger does not find table
CREATE
TABLE
table1
(
a
int
);
CREATE
TABLE
table2
(
b
int
);
# Database name is only available (for printing) if specified in
# the trigger definition
CREATE
TRIGGER
trg1
AFTER
INSERT
ON
table1
FOR
EACH
ROW
INSERT
INTO
table2
SELECT
t
.
notable
.*
;
--
error
ER_BAD_TABLE_ERROR
INSERT
INTO
table1
VALUES
(
1
);
DROP
TABLE
table1
,
table2
;
--
echo
# End BUG#34750
sql/sql_base.cc
View file @
47f43867
...
@@ -8322,9 +8322,16 @@ insert_fields(THD *thd, Name_resolution_context *context, const char *db_name,
...
@@ -8322,9 +8322,16 @@ insert_fields(THD *thd, Name_resolution_context *context, const char *db_name,
meaningful message than ER_BAD_TABLE_ERROR.
meaningful message than ER_BAD_TABLE_ERROR.
*/
*/
if
(
!
table_name
)
if
(
!
table_name
)
my_message
(
ER_NO_TABLES_USED
,
ER
(
ER_NO_TABLES_USED
),
MYF
(
0
));
my_error
(
ER_NO_TABLES_USED
,
MYF
(
0
));
else
if
(
!
db_name
&&
!
thd
->
db
)
my_error
(
ER_NO_DB_ERROR
,
MYF
(
0
));
else
else
my_error
(
ER_BAD_TABLE_ERROR
,
MYF
(
0
),
table_name
);
{
char
name
[
FN_REFLEN
];
my_snprintf
(
name
,
sizeof
(
name
),
"%s.%s"
,
db_name
?
db_name
:
thd
->
db
,
table_name
);
my_error
(
ER_BAD_TABLE_ERROR
,
MYF
(
0
),
name
);
}
DBUG_RETURN
(
TRUE
);
DBUG_RETURN
(
TRUE
);
}
}
...
...
sql/sql_view.cc
View file @
47f43867
...
@@ -1652,7 +1652,7 @@ bool mysql_drop_view(THD *thd, TABLE_LIST *views, enum_drop_mode drop_mode)
...
@@ -1652,7 +1652,7 @@ bool mysql_drop_view(THD *thd, TABLE_LIST *views, enum_drop_mode drop_mode)
{
{
if
(
non_existant_views
.
length
())
if
(
non_existant_views
.
length
())
non_existant_views
.
append
(
','
);
non_existant_views
.
append
(
','
);
non_existant_views
.
append
(
String
(
view
->
table_name
,
system_charset_info
)
);
non_existant_views
.
append
(
name
);
}
}
else
else
{
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment