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

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

    Details

    • Type: Task
    • Status: Closed
    • Priority: Minor
    • Resolution: Duplicate
    • Fix Version/s: 10.0.1
    • Component/s: None
    • Labels:

      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.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

              Hide
              markdhas Mark Dhas added a comment -

              Re: Datetime field does not accept default NOW()
              Also FYI this is a link to the original MySQL bug: http://bugs.mysql.com/bug.php?id=27645

              Show
              markdhas Mark Dhas added a comment - Re: Datetime field does not accept default NOW() Also FYI this is a link to the original MySQL bug: http://bugs.mysql.com/bug.php?id=27645
              Hide
              ratzpo Rasmus Johansson added a comment -

              Launchpad bug id: 967396

              Show
              ratzpo Rasmus Johansson added a comment - Launchpad bug id: 967396

                People

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

                  Dates

                  • Created:
                    Updated:
                    Resolved: