← Back to team overview

maria-developers team mailing list archive

WL#238 New (by Snabb): Implement NOW() default value for DATETIME columns

 

-----------------------------------------------------------------------
                              WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Implement NOW() default value for DATETIME columns
CREATION DATE..: Tue, 27 Sep 2011, 14:05
SUPERVISOR.....: 
IMPLEMENTOR....: 
COPIES TO......: 
CATEGORY.......: Server-RawIdeaBin
TASK ID........: 238 (http://askmonty.org/worklog/?tid=238)
VERSION........: Server-9.x
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0

PROGRESS NOTES:



DESCRIPTION:

Have a look at MySQL bug #27645: http://bugs.mysql.com/bug.php?id=27645

Currently it is possible to set the default value of a TIMESTAMP column to
CURRENT_TIME but this is not possible with DATETIME columns.

Looking at that bug report it looks like I am not the only one who wishes to use
DATETIME columns and have a way of setting their default value to the time when
the row was created.

Also TIMESTAMP DEFAULT CURRENT_TIME can occur only once in a table. It should be
possible to have several "DATETIME DEFAULT NOW()" columns (as this is useful for
having automatically initialized created_time and modified_time columns for a
row, for example).

Looks like MariaDB might gain some supporters by implementing this much-wanted
feature. Currently the only decent work-around is to create a trigger which
populates DATETIME columns before insert.

(I hope this is the proper way to file a feature request.)


ESTIMATED WORK TIME

ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v4.0.0)