Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.5, 10.6, 10.2(EOL), 10.3(EOL), 10.4(EOL)
-
None
Description
While working on the task MDEV-16708 (Unsupported commands for prepared statements)
I hit the bug caused by incorrect handling of the ' SET STATEMENT' clause when the whole statement, containing the 'SET STATEMENT' clause, is executed in prepared statement mode.
The following test case shows the incorrect behavior:
PREPARE stmt FROM "SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR CREATE TABLE t1 AS SELECT CONCAT('abc') AS c1"; |
EXECUTE stmt; |
DEALLOCATE PREPARE stmt; |
SHOW CREATE TABLE t1; |
Table Create Table |
t1 CREATE TABLE `t1` ( |
`c1` varchar(3) DEFAULT NULL |
) ENGINE=MyISAM DEFAULT CHARSET=latin1 |
DROP TABLE t1; |
It's expected that the output from the command SHOW CREATE TABLE t1 shows
`c1` varchar(3) CHARACTER SET utf8 NOT NULL
for the column c1 as it takes place in case this statement is run as a regular statement.
Instead, SHOW CREATE TABLE t1 outputs the following data
`c1` varchar(3) CHARACTER SET utf8 DEFAULT NULL
as a definition of the column c1
Attachments
Issue Links
- blocks
-
MDEV-16708 Unsupported commands for prepared statements
- Closed
- causes
-
MDEV-29217 Assertion failure in Item_param::can_return_value upon PS with SET STATEMENT and placeholder for a value
- Open