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

TIMESTAMP NOT NULL field with explicit_defaults_for_timestamp and NO_ZERO_DATE shouldn't throw error

    XMLWordPrintable

    Details

      Description

      Given the following server options:

      explicit_defaults_for_timestamp
      sql_mode=ANSI,NO_ZERO_DATE
      

      and the following table creation code:

      create table test (
          a int,
          ts timestamp not null
      );
      

      The server throws the following error:

      SQL Error (1067): Invalid default value for 'ts'

      Why can't we create a table with TIMESTAMP field like a normal data type, where we force the user to specify a value, but without providing a default?

      (Remove the part about INSERT statement, since it seems to cause some confusion)

        Attachments

          Activity

            People

            Assignee:
            bar Alexander Barkov
            Reporter:
            nhahtdh Hong Dai Thanh
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Git Integration