summaryrefslogtreecommitdiff
path: root/mysql-test/t/insert_update.test
diff options
context:
space:
mode:
authorunknown <gkodinov/kgeorge@macbook.gmz>2007-03-16 10:35:39 +0200
committerunknown <gkodinov/kgeorge@macbook.gmz>2007-03-16 10:35:39 +0200
commit2e8e78a42cbe49d2e74381c9229d2e93c8df6f0d (patch)
treebcb1b42fa6a2377ab144ada7be2095e71e0c647e /mysql-test/t/insert_update.test
parent1f93b0c83af4b30b90e3a71eb6f2a663375feebc (diff)
downloadmariadb-git-2e8e78a42cbe49d2e74381c9229d2e93c8df6f0d.tar.gz
Bug #26261:
INSERT uses query_id to verify what fields are mentioned in the fields list of the INSERT command. However the check for that is made after the ON DUPLICATE KEY is processed. This causes all the fields mentioned in ON DUPLICATE KEY to be considered as mentioned in the fields list of INSERT. Moved the check up, right after processing the fields list. mysql-test/r/insert_update.result: Bug #26261: test case mysql-test/t/insert_update.test: Bug #26261: test case sql/mysql_priv.h: Bug #26261: moved the check inside mysql_prepare_insert sql/sql_insert.cc: Bug #26261: move the check inside mysql_prepare_insert before setting up the ON DUPLICATE KEY part sql/sql_prepare.cc: Bug #26261: moved the check inside mysql_prepare_insert
Diffstat (limited to 'mysql-test/t/insert_update.test')
-rw-r--r--mysql-test/t/insert_update.test21
1 files changed, 21 insertions, 0 deletions
diff --git a/mysql-test/t/insert_update.test b/mysql-test/t/insert_update.test
index 4581cc7a875..3ebcf7d8ff3 100644
--- a/mysql-test/t/insert_update.test
+++ b/mysql-test/t/insert_update.test
@@ -162,3 +162,24 @@ INSERT INTO t2 VALUES (1), (3);
--error ER_BAD_FIELD_ERROR
INSERT INTO t1 SELECT 1, COUNT(*) FROM t2 ON DUPLICATE KEY UPDATE j= a;
DROP TABLE t1,t2;
+
+#
+# Bug #26261: Missing default value isn't noticed in
+# insert ... on duplicate key update
+#
+SET SQL_MODE = 'TRADITIONAL';
+
+CREATE TABLE t1 (a INT PRIMARY KEY, b INT NOT NULL);
+
+--error 1364
+INSERT INTO t1 (a) VALUES (1);
+
+--error 1364
+INSERT INTO t1 (a) VALUES (1) ON DUPLICATE KEY UPDATE a = b;
+
+--error 1364
+INSERT INTO t1 (a) VALUES (1) ON DUPLICATE KEY UPDATE b = b;
+
+SELECT * FROM t1;
+
+DROP TABLE t1;