[MDEV-780] LP:967396 - Datetime field does not accept default NOW() Created: 2012-03-28  Updated: 2013-04-05  Resolved: 2013-04-05

Status: Closed
Project: MariaDB Server
Component/s: None
Fix Version/s: 10.0.1

Type: Task Priority: Minor
Reporter: Mark Dhas (Inactive) Assignee: Timour Katchaounov (Inactive)
Resolution: Duplicate Votes: 0
Labels: Launchpad

Attachments: XML File LPexportBug967396.xml    
Issue Links:
Duplicate
is duplicated by MDEV-452 Add full support for auto-initialized... Closed

 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.



 Comments   
Comment by Mark Dhas (Inactive) [ 2012-03-28 ]

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

Comment by Rasmus Johansson (Inactive) [ 2012-03-28 ]

Launchpad bug id: 967396

Generated at Thu Feb 08 06:31:17 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.