Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-24860

Incorrect behaviour of SET STATEMENT in case it is executed as a prepared statement

    XMLWordPrintable

Details

    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

          Activity

            People

              shulga Dmitry Shulga
              shulga Dmitry Shulga
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.