Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.2(EOL), 10.3(EOL), 10.4(EOL), 10.5, 10.6
-
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
-
Activity
Field | Original Value | New Value |
---|---|---|
Fix Version/s | 10.2 [ 14601 ] | |
Fix Version/s | 10.3 [ 22126 ] | |
Fix Version/s | 10.4 [ 22408 ] | |
Fix Version/s | 10.5 [ 23123 ] | |
Fix Version/s | 10.6 [ 24028 ] |
Status | Open [ 1 ] | In Progress [ 3 ] |
Assignee | Dmitry Shulga [ JIRAUSER47315 ] | Oleksandr Byelkin [ sanja ] |
Status | In Progress [ 3 ] | In Review [ 10002 ] |
Link |
This issue blocks |
Assignee | Oleksandr Byelkin [ sanja ] | Dmitry Shulga [ JIRAUSER47315 ] |
Status | In Review [ 10002 ] | Stalled [ 10000 ] |
Description |
While working on the task 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 |
While working on the task 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: {code:sql} 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; {code} 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 |
issue.field.resolutiondate | 2021-02-25 07:42:09.0 | 2021-02-25 07:42:09.526 |
Fix Version/s | 10.2.38 [ 25207 ] | |
Fix Version/s | 10.3.29 [ 25206 ] | |
Fix Version/s | 10.4.19 [ 25205 ] | |
Fix Version/s | 10.5.10 [ 25204 ] | |
Fix Version/s | 10.6.0 [ 24431 ] | |
Fix Version/s | 10.2 [ 14601 ] | |
Fix Version/s | 10.3 [ 22126 ] | |
Fix Version/s | 10.4 [ 22408 ] | |
Fix Version/s | 10.5 [ 23123 ] | |
Fix Version/s | 10.6 [ 24028 ] | |
Resolution | Fixed [ 1 ] | |
Status | Stalled [ 10000 ] | Closed [ 6 ] |
Workflow | MariaDB v3 [ 119146 ] | MariaDB v4 [ 158895 ] |
Link | This issue causes MDEV-29217 [ MDEV-29217 ] |