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

update date column with erroneous date does not return an error but sets to null

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Not a Bug
    • Affects Version/s: 10.0.16
    • Fix Version/s: N/A
    • Component/s: Temporal Types
    • Labels:
      None
    • Environment:
      Redhat Linux 2.6.32-431.29.2.el6.x86_64
      10.0.16-MariaDB-log

      Description

      We came across this issue when a developer tried to set a date value to 2015-04-31 only 30 days in April.
      If using the above value it will set that date column to null not throw an error.

      Test case

      CREATE TABLE test.baddate (
        id int(11) NOT NULL AUTO_INCREMENT,
        testtext varchar(255) DEFAULT NULL,
        startdate date DEFAULT '1970-01-01',
        enddate date DEFAULT '1970-01-01',
        PRIMARY KEY (id),
        INDEX UK_baddate_testtext (testtext)
      )
      ENGINE = INNODB
      AUTO_INCREMENT = 8
      AVG_ROW_LENGTH = 5461
      CHARACTER SET latin1
      COLLATE latin1_swedish_ci
      COMMENT = 'Testing of date bug in update with erroneous date';

      Insert some values

        INSERT INTO test.baddate(testtext) SELECT tp.Table_name FROM mysql.tables_priv tp;

      Check the contents All dates set to 01/01/1970

        SELECT * FROM test.baddate;

      Update to erroneous date value

        UPDATE test.baddate SET enddate = '2013-10-32';

      Evaluate the result

        SELECT * FROM test.baddate;

      Date is now null in the column set to erroneous date

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                Meerkat63 Peter McLarty
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Due:
                  Created:
                  Updated:
                  Resolved: