sql-metadata icon indicating copy to clipboard operation
sql-metadata copied to clipboard

Reusing an alias name on CTE's with the same column name produces an error

Open christopherpickering opened this issue 3 years ago • 0 comments

When using CTE's with queries use the same alias name on the tables, and table with the same column names, there is an error.

For example, a valid but messy CTE that failed:

with
 cte_one AS (SELECT cte_id, cte_name FROM cte_one_table),
 cte_two AS (SELECT B.cte_id FROM cte_one B),
 cte_three AS (SELECT B.id FROM (SELECT id FROM table_two) B)

christopherpickering avatar Nov 16 '21 13:11 christopherpickering