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

ON UPDATE is not preserved by CREATE TABLE .. SELECT

    XMLWordPrintable

Details

    Description

      This script:

      DROP TABLE IF EXISTS t1,t2;
      CREATE TABLE t1 (
        vc VARCHAR(10) NOT NULL DEFAULT 'test',
        ts timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP
      ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
      CREATE TABLE t2 AS SELECT * FROM t1 LIMIT 0;
      SHOW CREATE TABLE t2;

      returns

      +-------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
      | Table | Create Table                                                                                                                                                 |
      +-------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
      | t2    | CREATE TABLE `t2` (
        `vc` varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT 'test',
        `ts` timestamp NULL DEFAULT NULL
      ) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
      +-------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+

      Notice: DEFAULT is preserved, ON UPDATE is not.

      The expected behaviour is to preserve both.

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.