mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Bug #54106 assert in Protocol::end_statement,
INSERT IGNORE ... SELECT ... UNION SELECT ... This assert was triggered by INSERT IGNORE ... SELECT. The assert checks that a statement either sends OK or an error to the client. If the bug was triggered on release builds, it caused OK to be sent to the client instead of the correct error message (in this case ER_FIELD_SPECIFIED_TWICE). The reason the assert was triggered, was that lex->no_error was set to TRUE during JOIN::optimize() because of IGNORE. This causes all errors to be ignored. However, not all errors can be ignored. Some, such as ER_FIELD_SPECIFIED_TWICE will cause the INSERT to fail no matter what. But since lex->no_error was set, the critical errors were ignored, the INSERT failed and neither OK nor the error message was sent to the client. This patch fixes the problem by temporarily turning off lex->no_error in places where errors cannot be ignored during processing of INSERT ... SELECT. Test case added to insert.test.
This commit is contained in:
@ -639,3 +639,18 @@ CREATE TABLE t2(f1 CHAR(1));
|
||||
INSERT INTO t2 SELECT f1 FROM t1;
|
||||
DROP TABLE t1, t2;
|
||||
End of 5.0 tests.
|
||||
#
|
||||
# Bug#54106 assert in Protocol::end_statement,
|
||||
# INSERT IGNORE ... SELECT ... UNION SELECT ...
|
||||
#
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1 (a INT);
|
||||
INSERT INTO t1 (a, a) VALUES (1, 1);
|
||||
ERROR 42000: Column 'a' specified twice
|
||||
INSERT IGNORE t1 (a, a) VALUES (1, 1);
|
||||
ERROR 42000: Column 'a' specified twice
|
||||
INSERT IGNORE t1 (a, a) SELECT 1,1;
|
||||
ERROR 42000: Column 'a' specified twice
|
||||
INSERT IGNORE t1 (a, a) SELECT 1,1 UNION SELECT 2,2;
|
||||
ERROR 42000: Column 'a' specified twice
|
||||
DROP TABLE t1;
|
||||
|
Reference in New Issue
Block a user