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

ON UPDATE is not preserved by CREATE TABLE .. SELECT

    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.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

              Hide
              bar Alexander Barkov added a comment -

              The patch for mdev-7778 fixes this problem as well. Waiting for Serg to review 7778.

              Show
              bar Alexander Barkov added a comment - The patch for mdev-7778 fixes this problem as well. Waiting for Serg to review 7778.

                People

                • Assignee:
                  bar Alexander Barkov
                  Reporter:
                  bar Alexander Barkov
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: