Describe the bug
CTAS with an explicit schema fails when qualified source columns have the same unqualified name.
To Reproduce
CREATE TABLE dup_src AS VALUES (1, 2);
CREATE TABLE dup_ctas_with_schema(left_c1 BIGINT, right_c1 BIGINT) AS
SELECT dup_src.column1, right_src.column1
FROM dup_src
CROSS JOIN (SELECT column2 AS column1 FROM dup_src) right_src;
The second statement fails with:
Error: Schema error: Ambiguous reference to unqualified field column1
Expected behavior
The CREATE TABLE statement should succeed because the source columns are qualified and the target column names are unique.
Additional context
No response
Describe the bug
CTAS with an explicit schema fails when qualified source columns have the same unqualified name.
To Reproduce
The second statement fails with:
Error: Schema error: Ambiguous reference to unqualified field column1Expected behavior
The
CREATE TABLEstatement should succeed because the source columns are qualified and the target column names are unique.Additional context
No response