summaryrefslogtreecommitdiff
path: root/mysql-test/t/default.test
diff options
context:
space:
mode:
authorGleb Shchepa <gshchepa@mysql.com>2008-09-03 12:32:43 +0500
committerGleb Shchepa <gshchepa@mysql.com>2008-09-03 12:32:43 +0500
commit6f94324fd83f536237f890c56124023918405898 (patch)
treefe6888d75c8d2fc410f330e826b7d2b0bd77a918 /mysql-test/t/default.test
parent5c256ec67a825c41eac0eaffef354ef73f6fb372 (diff)
downloadmariadb-git-6f94324fd83f536237f890c56124023918405898.tar.gz
Bug #39002: The server crashes on the query:
INSERT .. SELECT .. ON DUPLICATE KEY UPDATE col=DEFAULT In order to get correct values from update fields that belongs to the SELECT part in the INSERT .. SELECT .. ON DUPLICATE KEY UPDATE statement, the server adds referenced fields to the select list. Part of the code that does this transformation is shared between implementations of the DEFAULT(col) function and the DEFAULT keyword (in the col=DEFAULT expression), and an implementation of the DEFAULT keyword is incomplete.
Diffstat (limited to 'mysql-test/t/default.test')
-rw-r--r--mysql-test/t/default.test19
1 files changed, 19 insertions, 0 deletions
diff --git a/mysql-test/t/default.test b/mysql-test/t/default.test
index 14aa4b02cfe..b719cb83448 100644
--- a/mysql-test/t/default.test
+++ b/mysql-test/t/default.test
@@ -145,5 +145,24 @@ insert into t1 values(default);
drop view v1;
drop table t1;
+#
+# Bug #39002: crash with
+# INSERT ... SELECT ... ON DUPLICATE KEY UPDATE col=DEFAULT
+#
+
+create table t1 (a int unique);
+create table t2 (b int default 10);
+insert into t1 (a) values (1);
+insert into t2 (b) values (1);
+
+insert into t1 (a) select b from t2 on duplicate key update a=default;
+select * from t1;
+
+insert into t1 (a) values (1);
+insert into t1 (a) select b from t2 on duplicate key update a=default(b);
+select * from t1;
+
+drop table t1, t2;
+
--echo End of 5.0 tests.