Issue found by SQLSmith on git commit hash 50bb6 using seed 974777367.
To Reproduce
create table all_types as select * exclude(small_enum, medium_enum, large_enum) from test_all_types() limit 0;
SELECT (SELECT NULL), (SELECT NULL) AS c2, (SELECT NULL) AS c3, (SELECT NULL) AS c7, "nullif"((SELECT NULL), NULL) FROM (SELECT (SELECT tinyint FROM main.all_types LIMIT 1 OFFSET 3) AS c0, ref_0."bit" AS c1, ref_0.uuid AS c2 FROM main.all_types AS ref_0 WHERE (sha256(CAST(ref_0."varchar" AS VARCHAR)) ~~ ref_0."varchar")) AS subq_0 , (SELECT subq_1.c5 AS c0, subq_1.c2 AS c1, 35 AS c2, subq_0.c0 AS c3, (SELECT timestamp_array FROM main.all_types LIMIT 1 OFFSET 1) AS c4, subq_2.c0 AS c5 FROM (SELECT ref_1.timestamptz_array AS c0, subq_0.c2 AS c1, ref_1.dec38_10 AS c2, ref_1.fixed_varchar_array AS c3, subq_0.c0 AS c4, ref_1."varchar" AS c5, subq_0.c2 AS c6, ref_1.struct_of_fixed_array AS c7 FROM main.all_types AS ref_1 WHERE (ref_1."varchar" ~~* ref_1."varchar") LIMIT 80) AS subq_1 , (SELECT subq_1.c4 AS c0 FROM main.all_types AS ref_2 WHERE EXISTS(SELECT ref_2.fixed_nested_int_array AS c0, subq_0.c1 AS c1, subq_1.c5 AS c2, subq_0.c1 AS c3, 35 AS c4, subq_1.c1 AS c5, ref_3.fixed_int_array AS c6, ref_3.array_of_structs AS c7, subq_1.c3 AS c8, subq_1.c2 AS c9 FROM main.all_types AS ref_3 WHERE ((subq_0.c2 IS NOT NULL) AND 0) LIMIT 27) LIMIT 54) AS subq_2 WHERE (subq_1.c7 IS NOT NULL)) AS subq_3 WHERE (subq_3.c0 ~~ (SELECT "varchar" FROM main.all_types LIMIT 1 OFFSET 6))
Error Message
ABORT THROWN BY INTERNAL EXCEPTION: Failed to bind column reference "c0" [29.11] (bindings: {#[109.0], #[109.1], #[109.2], #[109.3], #[109.4], #[109.5], #[109.6]})
Issue found by SQLSmith on git commit hash 50bb6 using seed 974777367.
To Reproduce
Error Message