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

Dynamic CREATE TABLE does not preserve the data type of SP variables with NULL value

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.2(EOL), 10.3(EOL), 10.4(EOL)
    • 10.3(EOL)
    • None
    • None
    • 10.2.11

    Description

      DELIMITER $$
      BEGIN NOT ATOMIC
        DECLARE d0 DATETIME DEFAULT NULL;
        DECLARE d1 DATETIME DEFAULT '2001-01-01 00:00:00';
        DECLARE i0 INT DEFAULT NULL;
        DECLARE i1 INT DEFAULT 10;
        PREPARE stmt FROM 'CREATE OR REPLACE TABLE t1 AS SELECT ? AS c1,? AS c2,? AS c3,? AS c4';
        EXECUTE stmt USING d0,d1,i0,i1;
        DEALLOCATE PREPARE stmt;
        SHOW CREATE TABLE t1;
      END;
      $$
      DELIMITER ;
      

      +-------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
      | Table | Create Table                                                                                                                                                                      |
      +-------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
      | t1    | CREATE TABLE `t1` (
        `c1` binary(0) DEFAULT NULL,
        `c2` datetime DEFAULT NULL,
        `c3` binary(0) DEFAULT NULL,
        `c4` bigint(21) NOT NULL
      ) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
      +-------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
      

      The expected data type for c0 should be DATETIME (like for c1).
      The expected data type for c3 should be BIGINT (like for c3).

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

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