mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Fix for BUG#6808.
The problem was in that add_table_to_list was testing for duplicate tables in a list of tables that included the created view. mysql-test/r/view.result: Test for BUG#6808 mysql-test/t/view.test: Test for BUG#6808 sql/sql_parse.cc: When testing for table name uniquness, skip the first table the current statement is CREATE VIEW. Notice that the first table is skipped differently for CREATE TABLE ... SELECT ... statements, so we don't have to handle that case here (see production 'create_select', the call 'to save_and_clear').
This commit is contained in:
@ -1146,11 +1146,11 @@ create view v2 as select * from v1;
|
||||
alter view v1 as select * from v2;
|
||||
ERROR 42S02: Table 'test.v1' doesn't exist
|
||||
alter view v1 as select * from v1;
|
||||
ERROR 42000: Not unique table/alias: 'v1'
|
||||
ERROR 42S02: Table 'test.v1' doesn't exist
|
||||
create or replace view v1 as select * from v2;
|
||||
ERROR 42S02: Table 'test.v1' doesn't exist
|
||||
create or replace view v1 as select * from v1;
|
||||
ERROR 42000: Not unique table/alias: 'v1'
|
||||
ERROR 42S02: Table 'test.v1' doesn't exist
|
||||
drop view v2,v1;
|
||||
drop table t1;
|
||||
create table t1 (a int);
|
||||
@ -2186,3 +2186,7 @@ r_object_id users_names
|
||||
120001a080000542 guser02
|
||||
drop view v1, v2;
|
||||
drop table t1, t2;
|
||||
create table t1 (s1 int);
|
||||
create view abc as select * from t1 as abc;
|
||||
drop table t1;
|
||||
drop view abc;
|
||||
|
@ -1083,11 +1083,11 @@ create view v1 as select * from t1;
|
||||
create view v2 as select * from v1;
|
||||
-- error 1146
|
||||
alter view v1 as select * from v2;
|
||||
-- error 1066
|
||||
-- error 1146
|
||||
alter view v1 as select * from v1;
|
||||
-- error 1146
|
||||
create or replace view v1 as select * from v2;
|
||||
-- error 1066
|
||||
-- error 1146
|
||||
create or replace view v1 as select * from v1;
|
||||
drop view v2,v1;
|
||||
drop table t1;
|
||||
@ -2059,3 +2059,12 @@ order by users_names;
|
||||
|
||||
drop view v1, v2;
|
||||
drop table t1, t2;
|
||||
|
||||
#
|
||||
# Bug #6808 - Views: CREATE VIEW v ... FROM t AS v fails
|
||||
#
|
||||
|
||||
create table t1 (s1 int);
|
||||
create view abc as select * from t1 as abc;
|
||||
drop table t1;
|
||||
drop view abc;
|
||||
|
Reference in New Issue
Block a user