sql-metadata
sql-metadata copied to clipboard
Reusing an alias name on CTE's with the same column name produces an error
trafficstars
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)