[MDEV-28470] Please remove automatic TIMESTAMP update behaviour Created: 2022-05-04 Updated: 2022-05-20 Resolved: 2022-05-20 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Data Manipulation - Update, Temporal Types |
| Fix Version/s: | N/A |
| Type: | Task | Priority: | Critical |
| Reporter: | Lukas Eder | Assignee: | Sergei Golubchik |
| Resolution: | Duplicate | Votes: | 6 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Description |
|
I was going to report this bug:
Clearly, I don't want the result to be what it currently is:
It's so easy to achieve this behaviour if I wanted it by explicitly specifying the default. It's so hard to remember that this feature exists, having spent yet another 30 minutes debugging my own code until I was reminded of this: It's very random, why would the first TIMESTAMP ever be special? Why not the last? Or the fifth? What about DATETIME, why doesn't it apply there? I strongly suggest you remove this "feature," which looks like a bug to me every time I run into it, and it's really not the first time. Users can very easily specify DEFAULT expressions themselves |
| Comments |
| Comment by Simon Martinelli [ 2022-05-04 ] | ||||||||||||||||
|
For a beginner and even for experienced users coming from other databases this feature is very confusing. | ||||||||||||||||
| Comment by Mr Niall Litchfield [ 2022-05-04 ] | ||||||||||||||||
|
Agreed, consider also
In what sane world would anyone expect t1 and t2 to have different values because of the inconsistent ON UPDATE CURRENT | ||||||||||||||||
| Comment by Sergei Golubchik [ 2022-05-05 ] | ||||||||||||||||
|
This TIMESTAMP behavior existed in MariaDB and before it in MySQL since at least 1997. Almost every application that uses MariaDB has tables with TIMESTAMP fields. We simply cannot remove it without breaking a huge number of applications for a huge number of users. | ||||||||||||||||
| Comment by Lukas Eder [ 2022-05-06 ] | ||||||||||||||||
|
I understand it's a big change, but MySQL 8 has done it, too: https://dbfiddle.uk/?rdbms=mysql_8.0&fiddle=9bd50fd444283f7ffaa2feda3ebdaf5b. I haven't investigated MySQL's stance on backwards compatibility. I think a lot of features can be maintained by specifying some flags in your installation, to keep existing systems running like before? But for new systems, I don't really see the value of this feature, given that the ON UPDATE and DEFAULT clauses can be specified explicitly when this is desired. | ||||||||||||||||
| Comment by Alejandro Duarte [ 2022-05-06 ] | ||||||||||||||||
And there already is an option to control this behaviour (explicit_defaults_for_timestamp=ON|OFF). | ||||||||||||||||
| Comment by Ralf Gebhardt [ 2022-05-20 ] | ||||||||||||||||
|
I am changing this from Bug to Task as the current behavior is documented and used that way by many users. Changing the default of explicit_defaults_for_timestamp is not a bug fix. | ||||||||||||||||
| Comment by Ralf Gebhardt [ 2022-05-20 ] | ||||||||||||||||
|
| ||||||||||||||||
| Comment by Lukas Eder [ 2022-05-20 ] | ||||||||||||||||
|
Thanks a lot for addressing this! |