[MDEV-19611] INPLACE ALTER does not fail on bad implicit default value Created: 2019-05-28 Updated: 2021-08-23 Resolved: 2020-04-28 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - InnoDB |
| Affects Version/s: | 10.3, 10.4, 10.5 |
| Fix Version/s: | 10.3.23, 10.4.13, 10.5.3 |
| Type: | Bug | Priority: | Major |
| Reporter: | Alexander Barkov | Assignee: | Thirunarayanan Balathandayuthapani |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||||||
| Description |
|
In all below scripts we use ALTER for a table that:
Such ALTER should fail, because new fields in all existing rows should be assigned to '0000-00-00', which is not allowed. It fails with MyISAM:
It fails with INNODB, using COPY:
It does not fail with INNODB, using INPLACE:
Notice, it silently performed the ALTER without any warnings. |
| Comments |
| Comment by Marko Mäkelä [ 2019-05-28 ] |
|
thiru, I think that mysql_inplace_alter_table() must copy alter_ctx.error_if_not_empty to a new field of Alter_inplace_info. Then, ha_innobase::prepare_inplace_alter_table() would have to check this flag and return an error if the table is not empty. |
| Comment by Thirunarayanan Balathandayuthapani [ 2020-04-25 ] |
|
Patch is in bb-10.3- |
| Comment by Marko Mäkelä [ 2020-04-27 ] |
|
It looks mostly OK, but please test with a smaller table. You can stop purge by issuing START TRANSACTION WITH CONSISTENT SNAPSHOT from another connection before issuing the DELETE that empties the table. See git grep purge_control for examples. |