[MDEV-14832] CTE does not work with system versioning fields Created: 2017-12-31  Updated: 2018-03-04  Resolved: 2018-03-04

Status: Closed
Project: MariaDB Server
Component/s: Optimizer - CTE, Versioned Tables
Affects Version/s: N/A
Fix Version/s: 10.3.5

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Aleksey Midenkov
Resolution: Fixed Votes: 0
Labels: None
Environment:

bb-10.3-temporal a3a15126f260e26b715ae9a790135df1822b74d8


Issue Links:
Relates
relates to MDEV-14820 System versioning is applied incorrec... Closed

 Description   

CREATE OR REPLACE TABLE t1 (i INT) WITH SYSTEM VERSIONING;
WITH cte AS ( SELECT sys_trx_start FROM t1 ) SELECT * FROM cte;
 
# Cleanup
DROP TABLE t1;

MariaDB [test]> WITH cte AS ( SELECT sys_trx_start FROM t1 ) SELECT * FROM cte;
ERROR 1096 (HY000): No tables used

I assume it's specific to versioning and not to our implementation of hidden columns, because this works:

set statement debug_dbug= "+d,test_pseudo_invisible" 
  for create or replace table t1 (a int);
with cte as ( select invisible from t1 ) select * from cte;


Generated at Thu Feb 08 08:16:37 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.