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

LP:967396 - Datetime field does not accept default NOW()

    XMLWordPrintable

    Details

      Description

      How to re-recreate bug:

      Maria[test]>CREATE TABLE testdefaultnow (createdtime DATETIME DEFAULT NOW());
      ERROR 1067 (42000): Invalid default value for 'createdtime'

      Why we need it:

      While obviously there are ways around this using triggers and/or timestamps. Currently you can only have one timestamp column per table

      Maria[test]>CREATE TABLE testdefaultnow (createdtime timestamp default current_timestamp(), updatedtime timestamp default current_timestamp());
      ERROR 1293 (HY000): Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause

      Ideally we'd be able to create tables that have a create time and an update time.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              timour Timour Katchaounov (Inactive)
              Reporter:
              markdhas Mark Dhas (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: