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

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

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 5.5, 10.0, 10.1, 10.2
    • Fix Version/s: 10.3, 10.4
    • Component/s: Temporal Types
    • Labels:
      None

      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: