[MDEV-18158] Views WITH CHECK OPTION work inconsistently for different engines and key structures and produces bogus ER_KEY_NOT_FOUND Created: 2019-01-06 Updated: 2023-04-27 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | Views |
| Affects Version/s: | 5.5, 10.0, 10.1, 10.2, 10.3, 10.4, 10.5 |
| Fix Version/s: | 10.4, 10.5, 10.6 |
| Type: | Bug | Priority: | Major |
| Reporter: | Elena Stepanova | Assignee: | Oleksandr Byelkin |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | affects-tests, upstream | ||
| Description |
|
If a view is created WITH CHECK OPTION, INSERTs which violate the WHERE condition and UPDATEs which update visible rows to invisible are supposed to be rejected with ER_VIEW_CHECK_FAILED. In reality, it's all over the place – sometimes such UPDATEs indeed produce ER_VIEW_CHECK_FAILED, sometimes other errors, sometimes they even succeed.
In this case UPDATE fails with ER_KEY_NOT_FOUND instead of ER_VIEW_CHECK_FAILED (and ER_KEY_NOT_FOUND is also written to the error log, thus producing a bogus alert about corruption).
The same test case, but with InnoDB, allows UPDATE to proceed, thus removing the row with f2=0 from the view:
A similar test case, but with a non-unique key instead of unique on f2, allows the UPDATE to proceed with both MyISAM and InnoDB:
The same test case as test case 2, but without a WHERE clause in UPDATE, works as expected with both MyISAM and InnoDB:
etc. – there are many variations. |
| Comments |
| Comment by Elena Stepanova [ 2019-09-06 ] |
|
The problem with it is that it produces corruption-like errors, which are likely to mask other (more important) issues during testing. |