[MDEV-32183] Incorrect name resolution in CTE Created: 2023-09-15  Updated: 2023-11-28

Status: Open
Project: MariaDB Server
Component/s: Optimizer - CTE
Affects Version/s: 10.8.8, 10.4.31, 11.3, 10.6.15, 10.9.8, 10.11.5, 11.0.3, 11.1.2, 11.2.1
Fix Version/s: 10.4, 10.6, 10.11, 11.0, 11.1, 11.2, 11.3

Type: Bug Priority: Major
Reporter: Rex Johnston Assignee: Rex Johnston
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-31995 Bogus error executing PS for query us... Closed

 Description   

 
create table t1 (c1 int, c2 int, c3 int);
create table t2 like t1;
 
with d3 (a1, a2, a3) as (select * from t1 union select * from t2 order by c1) select * from d3;

ERROR 1054 (42S22): Unknown column 'c1' in 'order clause'

code in st_select_lex_unit::prepare() is renaming columns in the select_lex before name resolution happens (in this case setting up order).


Generated at Thu Feb 08 10:29:28 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.