summaryrefslogtreecommitdiff
path: root/mysql-test/r/insert_select.result
diff options
context:
space:
mode:
authorunknown <timour/timka@lamia.home>2006-09-12 17:50:24 +0300
committerunknown <timour/timka@lamia.home>2006-09-12 17:50:24 +0300
commit900e66f89567d740c4290963825206ac8a672df8 (patch)
tree286e374656cd969885c91d0497b5c1d7551aee72 /mysql-test/r/insert_select.result
parent01ec88dcd8d49aede05ba1f22270708d132f3ffe (diff)
downloadmariadb-git-900e66f89567d740c4290963825206ac8a672df8.tar.gz
Fix for BUG#21774: Column count doesn't match value count at row x
The cause of the bug was an incomplete fix for bug 18080. The problem was that setup_tables() unconditionally reset the name resolution context to its 'tables' argument, which pointed to the first table of an SQL statement. The bug fix limits resetting of the name resolution context in setup_tables() only in the cases when the context was not set by earlier parser/optimizer phases. mysql-test/r/insert_select.result: Test for BUG#21774. mysql-test/t/insert_select.test: Test for BUG#21774. sql/sql_base.cc: Do not reset the name resolution contect unconditionally. Instead set the context to 'tables' only if it was not set before calling setup_tables(). sql/sql_insert.cc: Added asserts to make sure that in the case of INSERT ... VALUES ... statements it is not necessary to reset the name resolution context to the first table, because there is only one table in the list of tables anyway. The actual code is not removed in order not to confuse it with the actual bug fix. sql/sql_parse.cc: Removed unnecessary reset of the name resolution context. The context is anyway unconditionally reset in mysql_insert() and mysql_prepare_insert().
Diffstat (limited to 'mysql-test/r/insert_select.result')
-rw-r--r--mysql-test/r/insert_select.result10
1 files changed, 10 insertions, 0 deletions
diff --git a/mysql-test/r/insert_select.result b/mysql-test/r/insert_select.result
index 89ac863b8d2..0af48d27cd5 100644
--- a/mysql-test/r/insert_select.result
+++ b/mysql-test/r/insert_select.result
@@ -695,6 +695,16 @@ CREATE TABLE t2 (z int, y int);
CREATE TABLE t3 (a int, b int);
INSERT INTO t3 (SELECT x, y FROM t1 JOIN t2 USING (y) WHERE z = 1);
DROP TABLE IF EXISTS t1,t2,t3;
+CREATE DATABASE bug21774_1;
+CREATE DATABASE bug21774_2;
+CREATE TABLE bug21774_1.t1(id VARCHAR(10) NOT NULL,label VARCHAR(255));
+CREATE TABLE bug21774_2.t1(id VARCHAR(10) NOT NULL,label VARCHAR(255));
+CREATE TABLE bug21774_1.t2(id VARCHAR(10) NOT NULL,label VARCHAR(255));
+INSERT INTO bug21774_2.t1 SELECT t1.* FROM bug21774_1.t1;
+use bug21774_1;
+INSERT INTO bug21774_2.t1 SELECT t1.* FROM t1;
+DROP DATABASE bug21774_1;
+DROP DATABASE bug21774_2;
CREATE DATABASE meow;
CREATE TABLE table_target ( mexs_id CHAR(8), messzeit TIMESTAMP, PRIMARY KEY (mexs_id));
CREATE TABLE table_target2 ( mexs_id CHAR(8), messzeit TIMESTAMP, PRIMARY KEY (mexs_id));