summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <ram@gw.mysql.r18.ru>2004-09-02 16:25:32 +0500
committerunknown <ram@gw.mysql.r18.ru>2004-09-02 16:25:32 +0500
commite230217f4d2474a36c13a2a5003e6146d4f28453 (patch)
tree7a5317dd2ea2f292ff0b8ced2ad8590e3615c7ac
parentac55058d78b353504d96f9d2965fb57e2cd81d9b (diff)
parentbf268802916d85f7fa4cb832a409e20ab404effa (diff)
downloadmariadb-git-e230217f4d2474a36c13a2a5003e6146d4f28453.tar.gz
Merge rkalimullin@bk-internal.mysql.com:/home/bk/mysql-4.0
into gw.mysql.r18.ru:/usr/home/ram/work/4.0.b5232
-rw-r--r--mysql-test/r/merge.result9
-rw-r--r--mysql-test/t/merge.test14
-rw-r--r--sql/sql_parse.cc13
3 files changed, 36 insertions, 0 deletions
diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result
index 7b2b9a47b0f..3585b8b0018 100644
--- a/mysql-test/r/merge.result
+++ b/mysql-test/r/merge.result
@@ -610,3 +610,12 @@ x y
1 3
1 2
drop table t1,t2,t3;
+create table t1 (a int);
+create table t2 (a int);
+insert into t1 values (0);
+insert into t2 values (1);
+create table t3 engine=merge union=(t1, t2) select * from t1;
+INSERT TABLE 't1' isn't allowed in FROM table list
+create table t3 engine=merge union=(t1, t2) select * from t2;
+INSERT TABLE 't2' isn't allowed in FROM table list
+drop table t1, t2;
diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test
index 76382a9cd99..57770dc0a0b 100644
--- a/mysql-test/t/merge.test
+++ b/mysql-test/t/merge.test
@@ -250,3 +250,17 @@ select * from t3 where x = 1 and y < 5 order by y;
# Bug is that followng query returns empty set while it must be same as above
select * from t3 where x = 1 and y < 5 order by y desc;
drop table t1,t2,t3;
+
+#
+# Bug#5232: CREATE TABLE ... SELECT
+#
+
+create table t1 (a int);
+create table t2 (a int);
+insert into t1 values (0);
+insert into t2 values (1);
+--error 1093
+create table t3 engine=merge union=(t1, t2) select * from t1;
+--error 1093
+create table t3 engine=merge union=(t1, t2) select * from t2;
+drop table t1, t2;
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 14fc748c288..e95c52f1e48 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -1655,6 +1655,19 @@ mysql_execute_command(void)
net_printf(&thd->net,ER_INSERT_TABLE_USED,tables->real_name);
DBUG_VOID_RETURN;
}
+ if (lex->create_info.used_fields & HA_CREATE_USED_UNION)
+ {
+ TABLE_LIST *tab;
+ for (tab= tables; tab; tab= tab->next)
+ {
+ if (check_dup(tables->db, tab->real_name,
+ (TABLE_LIST*)lex->create_info.merge_list.first))
+ {
+ net_printf(&thd->net, ER_INSERT_TABLE_USED, tab->real_name);
+ DBUG_VOID_RETURN;
+ }
+ }
+ }
if (tables->next)
{
TABLE_LIST *table;