mirror of
https://github.com/MariaDB/server.git
synced 2025-04-21 22:55:35 +02:00
MDEV-29344: engines/iuds.insert_time cannot run with PS protocol (syntax error)
The syntax error produced on running the test engines/iuds.insert_time in PS-mode was caused by presence of the C-Style comment containing the single quote at the end of SQL statement, something like the following one: /* doesn't throw error */; Presence of the single quote was interpreted by mysqltest utility as indication of real string literal, that resulted in consuming every characters following that mark as a literal, including the delimiter character ';'. It led to concatenation of lines into a single multi-statement that was sent from mysqltest to MariaDB server for processing. In case mysqltest is run in regular mode (that is, not PS-mode), multi-statement is handled successfully on server side, but in case PS-mode is on, multi-statement is supplied in COM_STMT_PREPARE that caused the parsing error since multi-statements is not supported by statement prepare command. To fix the issue, in case mysqltest encounters the C-Style comment is should switch to reading next following characters without any processing until it hit the closing C-style comment marks '*/', with one exception if the sequence of characters '/*' followed by the exclamation mark, that means the hint introducer has been read.
This commit is contained in:
parent
a8e35a1cc6
commit
408a637b87
4 changed files with 34 additions and 1 deletions
client
mysql-test
|
@ -6744,7 +6744,7 @@ int read_line()
|
|||
my_bool have_slash= FALSE;
|
||||
|
||||
enum {R_NORMAL, R_Q, R_SLASH_IN_Q,
|
||||
R_COMMENT, R_LINE_START} state= R_LINE_START;
|
||||
R_COMMENT, R_LINE_START, R_CSTYLE_COMMENT} state= R_LINE_START;
|
||||
DBUG_ENTER("read_line");
|
||||
|
||||
*p= 0;
|
||||
|
@ -6831,9 +6831,23 @@ int read_line()
|
|||
state= R_Q;
|
||||
}
|
||||
}
|
||||
else if (c == '*' && last_char == '/')
|
||||
{
|
||||
state= R_CSTYLE_COMMENT;
|
||||
break;
|
||||
}
|
||||
have_slash= is_escape_char(c, last_quote);
|
||||
break;
|
||||
|
||||
case R_CSTYLE_COMMENT:
|
||||
if (c == '!')
|
||||
// Got the hint introducer '/*!'. Switch to normal processing of
|
||||
// next following characters
|
||||
state= R_NORMAL;
|
||||
else if (c == '/' && last_char == '*')
|
||||
state= R_NORMAL;
|
||||
break;
|
||||
|
||||
case R_COMMENT:
|
||||
if (c == '\n')
|
||||
{
|
||||
|
|
|
@ -989,4 +989,13 @@ select "foo\""bar";
|
|||
foo\"bar
|
||||
foo\"bar
|
||||
set sql_mode=default;
|
||||
#
|
||||
# MDEV-29344: engines/iuds.insert_time cannot run with PS protocol (syntax error)
|
||||
#
|
||||
SELECT 1 /* doesn't throw error */;
|
||||
1
|
||||
1
|
||||
SELECT 1 /* doesn't throw error */;
|
||||
1
|
||||
1
|
||||
End of tests
|
||||
|
|
|
@ -2954,6 +2954,12 @@ set sql_mode=no_backslash_escapes;
|
|||
select "foo\""bar";
|
||||
set sql_mode=default;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-29344: engines/iuds.insert_time cannot run with PS protocol (syntax error)
|
||||
--echo #
|
||||
SELECT 1 /* doesn't throw error */;
|
||||
SELECT 1 /* doesn't throw error */;
|
||||
|
||||
--echo End of tests
|
||||
|
||||
# Wait till we reached the initial number of concurrent sessions
|
||||
|
|
|
@ -5073,10 +5073,14 @@ ERROR 23000: Duplicate entry '825:23:00' for key 'c2'
|
|||
INSERT INTO t3(c1,c2) VALUES('34 9:23','34 9:23') /* throws error as row exists with c1='34 9:23',c2='34 9:23' */;
|
||||
ERROR 23000: Duplicate entry '825:23:00-825:23:00' for key 'idx'
|
||||
INSERT IGNORE INTO t1(c1,c2) VALUES('10:22:33','10:22:34') /* doesn't throw error */;
|
||||
Warnings:
|
||||
Warning 1062 Duplicate entry '10:22:33' for key 'PRIMARY'
|
||||
INSERT IGNORE INTO t2(c1,c2) VALUES('12:34:56.78','12:34:56.78') /*doesn't throw error */;
|
||||
Warnings:
|
||||
Warning 1062 Duplicate entry '12:34:56-12:34:56' for key 'PRIMARY'
|
||||
INSERT IGNORE INTO t1(c1,c2) VALUES('10:22:34','34 9:23') /*doesn't throw error */;
|
||||
Warnings:
|
||||
Warning 1062 Duplicate entry '825:23:00' for key 'c2'
|
||||
INSERT IGNORE INTO t3(c1,c2) VALUES('34 9:23','34 9:23') /*doesn't throw error */;
|
||||
Warnings:
|
||||
Warning 1062 Duplicate entry '825:23:00-825:23:00' for key 'idx'
|
||||
|
|
Loading…
Add table
Reference in a new issue