summaryrefslogtreecommitdiff
path: root/mysql-test/t/ps.test
diff options
context:
space:
mode:
authorunknown <dlenev@mockturtle.local>2007-01-24 19:26:06 +0300
committerunknown <dlenev@mockturtle.local>2007-01-24 19:26:06 +0300
commit076455acf23d0ff5a81c4641d40ef854ff28e2ff (patch)
treec076d2c719675ee2705ea0bf80abdae4d389738a /mysql-test/t/ps.test
parentb0ff1cd2ca8a6449cdbcf5cce89898409f69d609 (diff)
parentd7c42fbef245dc7d86fa218373687348b09a20d4 (diff)
downloadmariadb-git-076455acf23d0ff5a81c4641d40ef854ff28e2ff.tar.gz
Merge bk-internal.mysql.com:/home/bk/mysql-5.1
into mockturtle.local:/home/dlenev/src/mysql-5.1-merge mysql-test/t/disabled.def: Auto merged mysql-test/t/ps.test: Auto merged sql/sql_view.cc: Auto merged
Diffstat (limited to 'mysql-test/t/ps.test')
-rw-r--r--mysql-test/t/ps.test31
1 files changed, 31 insertions, 0 deletions
diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test
index 34f9a6fb699..805abe99426 100644
--- a/mysql-test/t/ps.test
+++ b/mysql-test/t/ps.test
@@ -1574,6 +1574,7 @@ execute sq;
deallocate prepare no_index;
deallocate prepare sq;
+
#
# Bug 25027: query with a single-row non-correlated subquery
# and IS NULL predicate
@@ -1597,6 +1598,36 @@ DEALLOCATE PREPARE stmt;
DROP TABLE t1,t2;
+
+#
+# BUG#24491 "using alias from source table in insert ... on duplicate key"
+#
+--disable_warnings
+drop tables if exists t1;
+--enable_warnings
+create table t1 (id int primary key auto_increment, value varchar(10));
+insert into t1 (id, value) values (1, 'FIRST'), (2, 'SECOND'), (3, 'THIRD');
+# Let us prepare INSERT ... SELECT ... ON DUPLICATE KEY UPDATE statement
+# which in its ON DUPLICATE KEY clause erroneously tries to assign value
+# to a column which is mentioned only in SELECT part.
+prepare stmt from "insert into t1 (id, value) select * from (select 4 as i, 'FOURTH' as v) as y on duplicate key update v = 'DUP'";
+# Both first and second attempts to execute it should fail
+--error ER_BAD_FIELD_ERROR
+execute stmt;
+--error ER_BAD_FIELD_ERROR
+execute stmt;
+deallocate prepare stmt;
+# And now the same test for more complex case which is more close
+# to the one that was reported originally.
+prepare stmt from "insert into t1 (id, value) select * from (select 4 as id, 'FOURTH' as value) as y on duplicate key update y.value = 'DUP'";
+--error ER_BAD_FIELD_ERROR
+execute stmt;
+--error ER_BAD_FIELD_ERROR
+execute stmt;
+deallocate prepare stmt;
+drop tables t1;
+
+
--echo End of 5.0 tests.
#