[MDEV-17094] ON UPDATE NOW on period fields could break constraints Created: 2018-08-29 Updated: 2019-02-04 Resolved: 2019-02-04 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Versioned Tables |
| Affects Version/s: | 10.4 |
| Fix Version/s: | 10.4.0 |
| Type: | Bug | Priority: | Minor |
| Reporter: | Nikita Malyavin | Assignee: | Nikita Malyavin |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Description |
| Comments |
| Comment by Sergei Golubchik [ 2018-08-30 ] |
|
I think it's a not a bug and `ON UPDATE CURRENT_TIMESTAMP` should be added as everywhere else. |
| Comment by Nikita Malyavin [ 2018-09-21 ] |
|
You see, when we UPDATE FOR PORTION..., the inserted row fields are generated/filled with default values. This means, that ON UPDATE NOW field will be also filled, with now() Next, if period start field is ON UPDATE NOW, it will break the CHECK(start < end) constraint, which is always implicitly added with PERIOD. Same for the end field, but the IMO values are usually less then now() The SQL standard guarantees, that no additional checks should be done on these inserts. For it they explicitly forbid period start/end columns to be generated. So either should be done:
I did not realize it, when was creating the task, but that is what it should be about. |
| Comment by Nikita Malyavin [ 2019-02-04 ] |
|
Done in |