[MDEV-15966] Behavior for TRUNCATE versioned table is not documented and not covered by tests Created: 2018-04-21 Updated: 2022-05-02 Resolved: 2019-08-05 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Documentation, Versioned Tables |
| Affects Version/s: | 10.3 |
| Fix Version/s: | 10.4.5 |
| Type: | Bug | Priority: | Major |
| Reporter: | Elena Stepanova | Assignee: | Sergei Golubchik |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Description |
|
TRUNCATE TABLE on a versioned table removes all table contents, including historical records. I can only assume it's expected behavior, I can't find it documented anywhere in the KB, and there is no MTR test for TRUNCATE – I found only one test which uses the command, partition.test, but it does not check the result of truncation, it only executes the statement as a regression test for a crash. If it works as designed, please add a test and have it documented. If not, then please fix. |
| Comments |
| Comment by Sergei Golubchik [ 2018-04-25 ] |
|
TRUNCATE is DDL, it's defined as DROP+CREATE, and it requires DROP privilege. Naturally, DROP+CREATE does not preserve history. |
| Comment by Eugene Kosov (Inactive) [ 2018-04-25 ] |
|
TRUNCATE disallowed for system-versioned tables by standard in 14.10 <truncate table statement> |
| Comment by Sergei Golubchik [ 2018-04-26 ] |
|
Good point. Shall we do the same? |
| Comment by Eugene Kosov (Inactive) [ 2018-04-26 ] |
|
I vote for the standard compliance. |
| Comment by Ian Gilfillan [ 2018-04-27 ] |
|
Agree, TRUNCATE should not be permitted for system-versioned tables. I will document the current behaviour, and leave this task to be reassigned for implementation. |
| Comment by Vincent Milum Jr [ 2022-05-02 ] |
|
I think this topic needs revisiting, as the documentation and implementation don't align, plus the fact that this was actually very useful functionality to have TRUNCATE support on SYSTEM VERSIONED tables. I've opened MDEV-28439 to discuss this further along with all the details I've found so far. |