mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
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
This commit is contained in:
@ -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;
|
||||
|
Reference in New Issue
Block a user