Below is the list of changes that have just been committed into a local
5.0 repository of timka. When timka does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.1961 05/09/12 17:01:17 timour@stripped +3 -0
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.
sql/sql_parse.cc
1.483 05/09/12 17:01:14 timour@stripped +4 -1
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').
mysql-test/t/view.test
1.105 05/09/12 17:01:14 timour@stripped +11 -2
Test for BUG#6808
mysql-test/r/view.result
1.110 05/09/12 17:01:14 timour@stripped +6 -2
Test for BUG#6808
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: timour
# Host: lamia.home
# Root: /home/timka/mysql/src/5.0-2486
--- 1.482/sql/sql_parse.cc 2005-09-09 15:23:07 +03:00
+++ 1.483/sql/sql_parse.cc 2005-09-12 17:01:14 +03:00
@@ -6059,7 +6059,10 @@
/* check that used name is unique */
if (lock_type != TL_IGNORE)
{
- for (TABLE_LIST *tables=(TABLE_LIST*) table_list.first ;
+ TABLE_LIST *first_table= (TABLE_LIST*) table_list.first;
+ if (lex->sql_command == SQLCOM_CREATE_VIEW)
+ first_table= first_table ? first_table->next_local : NULL;
+ for (TABLE_LIST *tables= first_table ;
tables ;
tables=tables->next_local)
{
--- 1.109/mysql-test/r/view.result 2005-09-07 21:55:47 +03:00
+++ 1.110/mysql-test/r/view.result 2005-09-12 17:01:14 +03:00
@@ -1146,11 +1146,11 @@
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 @@
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;
--- 1.104/mysql-test/t/view.test 2005-09-07 21:55:47 +03:00
+++ 1.105/mysql-test/t/view.test 2005-09-12 17:01:14 +03:00
@@ -1083,11 +1083,11 @@
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 @@
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;
| Thread |
|---|
| • bk commit into 5.0 tree (timour:1.1961) BUG#6808 | timour | 12 Sep |