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

Copying from YEAR to DATE result in '0000-00-00'

    XMLWordPrintable

    Details

      Description

      These scripts:

      DROP TABLE IF EXISTS t1,t2;
      CREATE TABLE t1 (a DATETIME);
      CREATE TABLE t2 (a YEAR);
      INSERT INTO t2 VALUES (2000);
      INSERT INTO t1 SELECT * FROM t2;
      SELECT * FROM t1;

      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (a YEAR);
      INSERT INTO t1 VALUES (2000);
      ALTER TABLE t1 MODIFY a DATETIME;
      SHOW WARNINGS;
      SELECT * FROM t1;

      return

      +---------------------+
      | a                   |
      +---------------------+
      | 0000-00-00 00:00:00 |
      +---------------------+

      The year value could be preserved when NO_ZERO_IN_DATE is not set.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated: