The following valid SQL statement fails
with
t1(f1, f2) as (
select 1, 2
)
select
a1.f1,
a1.f2
from (
select * from t1
) a1
With the following error message:
Column "T1.F1" not found; SQL statement:
CREATE FORCE VIEW PUBLIC._16 AS
SELECT
T1.F1,
T1.F2
FROM (
SELECT
1,
2
FROM SYSTEM_RANGE(1, 1)
) [42122-196]
This works:
with
t1(f1, f2) as (
select 1, 2
)
select
a1.f1,
a1.f2
from t1 a1
The problem really seems to be related to nesting the CTE in a derived table
Probably related: #821