[MDEV-23968] CREATE TEMPORARY TABLE .. LIKE (system versioned table) returns error if unique index is defined in the table Created: 2020-10-15  Updated: 2020-10-20  Resolved: 2020-10-20

Status: Closed
Project: MariaDB Server
Component/s: Versioned Tables
Affects Version/s: 10.3, 10.4, 10.5
Fix Version/s: 10.3.26, 10.4.16, 10.5.7

Type: Bug Priority: Major
Reporter: Alice Sherepa Assignee: Aleksey Midenkov
Resolution: Fixed Votes: 0
Labels: None


 Description   

CREATE TABLE t1 (id int) with system versioning;
CREATE TEMPORARY TABLE tmp1 LIKE t1;
 
CREATE TABLE t2 (id int primary key) with system versioning;
CREATE TEMPORARY TABLE tmp2 LIKE t2;
 
drop table t1,t2;

MariaDB [test]> CREATE TABLE t1 (id int) with system versioning;
Query OK, 0 rows affected (0.059 sec)
 
MariaDB [test]> CREATE TEMPORARY TABLE tmp1 LIKE t1;
Query OK, 0 rows affected, 1 warning (0.014 sec)
Warning (Code 1105): System versioning is stripped from temporary `test.tmp1`
 
MariaDB [test]> CREATE TABLE t2 (id int,unique key (id)) with system versioning;
Query OK, 0 rows affected (0.046 sec)
 
MariaDB [test]> CREATE TEMPORARY TABLE tmp2 LIKE t2;
ERROR 1072 (42000): Key column 'row_end' doesn't exist in table
Warning (Code 1105): System versioning is stripped from temporary `test.tmp2`
Error (Code 1072): Key column 'row_end' doesn't exist in table



 Comments   
Comment by Elena Stepanova [ 2020-10-16 ]

I wonder how it should work. I think CREATE TEMPORARY TABLE is already "too smart", with its automatic stripping of system versioning; if it also starts removing parts of the unique keys, it might require artificial intelligence beyond its capabilities.

Generated at Thu Feb 08 09:26:27 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.