summaryrefslogtreecommitdiff
path: root/mysql-test/t/ps.test
diff options
context:
space:
mode:
authorunknown <dlenev@mockturtle.local>2007-01-23 15:57:46 +0300
committerunknown <dlenev@mockturtle.local>2007-01-23 15:57:46 +0300
commit41464df87ae6f35640c900cc197835f9889cfd0a (patch)
treebcff778091d885bc24f95cc9af6806d65f400e81 /mysql-test/t/ps.test
parentb6a82148ff254e2e8eeeb339b5dbcab1e4cb6c0a (diff)
parente81b97389ed0278804d418135fd66a9321f353e6 (diff)
downloadmariadb-git-41464df87ae6f35640c900cc197835f9889cfd0a.tar.gz
Merge bk-internal.mysql.com:/home/bk/mysql-5.0-runtime
into mockturtle.local:/home/dlenev/src/mysql-5.0-bg24491 sql/item.h: Auto merged mysql-test/r/ps.result: Manual merge. mysql-test/t/ps.test: Manual merge.
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 5f00aa60b11..3e9fe5539e2 100644
--- a/mysql-test/t/ps.test
+++ b/mysql-test/t/ps.test
@@ -1647,6 +1647,7 @@ execute sq;
deallocate prepare no_index;
deallocate prepare sq;
+
#
# Bug 25027: query with a single-row non-correlated subquery
# and IS NULL predicate
@@ -1741,4 +1742,34 @@ drop table t1, t2;
#deallocate prepare stmt;
#set @@character_set_server= @old_character_set_server;
+
+#
+# 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.