Details
-
Type:
Task
-
Status: Closed
-
Priority:
Major
-
Resolution: Fixed
-
Fix Version/s: 10.0.1
-
Component/s: None
-
Labels:None
Description
The task is to extract and backport all changes from MySQL 5.6 that move timestamp handling from the handler interface to the server.
The change was done by:
revno: 3402.50.105
committer: Martin Hansson <martin.hansson@oracle.com>
branch nick: mysql-wl5874-push
timestamp: Tue 2012-01-31 16:16:16 +0100
message:
WL#5874: CURRENT_TIMESTAMP as DEFAULT for DATETIME columns.
There is no public WL, however there is documentation:
http://dev.mysql.com/doc/refman/5.6/en/timestamp-initialization.html
First goal is to evaluate MySQL's patch, whether it makes sense to backport it, or to reimplement it.
Specifically check what are the changes to the FRM format, so that we can read MySQL 5.6 FRM files.
Additional patches to investigate:
Bug#11745578: 17392: ALTER TABLE ADD COLUMN TIMESTAMP
DEFAULT CURRENT_TIMESTAMP INSERTS ZERO
Possibly the following patch is related:
committer: Martin Hansson <martin.hansson@oracle.com>
branch nick: mysql-trunk-security
timestamp: Thu 2012-02-09 13:33:22 +0100
message:
Merge of fix for Bug#11765810.
In addition, MySQL 5.6.6 adds the following system variable, and corresponding change in behavior:
http://dev.mysql.com/doc/refman/5.6/en/server-system-variables.html#sysvar_explicit_defaults_for_timestamp
Since MySQL 5.6.6 is not Launchpad yet, it seems that the above is implemented by the following patches:
Gliffy Diagrams
Attachments
Issue Links
- duplicates
-
MDEV-780 LP:967396 - Datetime field does not accept default NOW()
-
- Closed
-
Activity
- All
- Comments
- Work Log
- History
- Activity
- Transitions
= The feature
The feature generalizes all the possible ways to set the default value, and to update automatically the value of both TIMESTAMP and DATETIME fields. It makes the clauses DEFAULT CURRENT_TIMESTAMP and ON UPDATE CURRENT_TIMESTAMP applicable to both TIMESTAMP and DATETIME fields, and allows to specify the default value as well as the update value on any TIMESTAMP and DATETIME field in the same table.
For full usability, the feature should be paired together with the system variable sysvar_explicit_defaults_for_timestamp from MySQL 5.6.6 that deprecates the implicit default values of TIMESTAMP fileds, and results in NULL behavior typical for other data types.
Therefore from feature perspective, this seems to useful. Backporting this feature will also allow MariaDB to be compatible in this respect with future MySQL versions.
= The code
The part of the diff related to code changes is 6096 lines, however only 4697 lines are related to changes in the server, the rest is unit testing code. Unfortunately until looking at this code I was totally unfamiliar with this area, therefore my analysis is not very deep.
From what I could tell by reading the patch:
Backporting the patch mechanically should be possible in 2-3 days, then we need to allocate time to backport the test cases, and to test the final result. With my current background I am not able to tell if there is a simpler and/or more ellegant way to implement this functionality.