Issue found by SQLSmith on git commit hash aef7b using seed 725996053.
To Reproduce
create table all_types as select * exclude(small_enum, medium_enum, large_enum) from test_all_types();
WITH jennifer_0 AS (SELECT ref_0."bigint" AS c0, ref_0."bigint" AS c1, ref_1.timestamp_s AS c2, ref_2."bigint" AS c3 FROM main.all_types AS ref_0 RIGHT JOIN main.all_types AS ref_1 INNER JOIN main.all_types AS ref_2 ON (ref_2."varchar") ON ((ref_0."float" = ref_1."float")) INNER JOIN main.all_types AS ref_3 RIGHT JOIN main.all_types ON (NULL) ON (EXISTS(SELECT ref_1.utinyint AS c0, NULL, NULL FROM main.all_types AS ref_5 INNER JOIN main.all_types AS ref_6 ON ((ref_6."varchar" !~~* ref_3."varchar")) INNER JOIN main.all_types AS ref_7 ON ((ref_5.blob = ref_7.blob)) , (SELECT ref_6.fixed_int_array AS c0 FROM main.all_types AS ref_8 WHERE ((SELECT "varchar" FROM main.all_types LIMIT 1 OFFSET 4) ~~~ CAST(NULL AS VARCHAR)) LIMIT 67) AS subq_0 WHERE 0 LIMIT 46)) WHERE (ref_2."varchar" ~~ ref_0."varchar") LIMIT 95)SELECT "version"() AS c0 FROM (SELECT subq_3.c3 AS c0, subq_4.c6 AS c1, subq_4.c3 AS c2, subq_3.c3 AS c3 FROM (SELECT ref_12.date AS c0, ref_12.fixed_nested_int_array AS c1, ref_12.timestamp_ns AS c2, ref_12."float" AS c3, ref_12.timestamptz_array AS c4, ref_12."time" AS c5 FROM main.all_types AS ref_12 WHERE ((ref_12."varchar" !~~* ref_12."varchar") AND (ref_12."varchar" ~~~ ref_12."varchar")) LIMIT 138) AS subq_3 , (SELECT subq_3.c3 AS c0, subq_3.c3 AS c1, ref_13.c0 AS c2, ref_13.c2 AS c3, ref_13.c0 AS c4, subq_3.c3 AS c5, subq_3.c2 AS c6, ref_13.c3 AS c7, ref_13.c1 AS c8, ref_13.c3 AS c9 FROM jennifer_0 AS ref_13 WHERE (ref_13.c1 IS NOT NULL) LIMIT 88) AS subq_4 WHERE EXISTS(SELECT ref_14.c3 AS c0, (SELECT fixed_nested_varchar_array FROM main.all_types LIMIT 1 OFFSET 6) AS c1, subq_3.c2 AS c2, subq_3.c3 AS c3, subq_3.c0 AS c4, (SELECT uhugeint FROM main.all_types LIMIT 1 OFFSET 1) AS c5, subq_3.c0 AS c6, subq_4.c0 AS c7, 91 AS c8, subq_3.c5 AS c9, subq_4.c8 AS c10, subq_4.c9 AS c11, subq_4.c8 AS c12, subq_4.c0 AS c13, subq_4.c3 AS c14, (SELECT "time" FROM main.all_types LIMIT 1 OFFSET 36) AS c15, ref_14.c0 AS c16, subq_3.c5 AS c17 FROM jennifer_0 AS ref_14 WHERE (CAST(NULL AS VARCHAR) !~~ (SELECT "varchar" FROM main.all_types LIMIT 1 OFFSET 4)))) AS subq_5 WHERE 1
Error Message
ABORT THROWN BY INTERNAL EXCEPTION: Failed to bind column reference "c0" [29.4] (bindings: {#[9.0], #[9.1], #[7.0], #[7.1], #[7.2], #[11.0], #[10.0]})
Issue found by SQLSmith on git commit hash aef7b using seed 725996053.
To Reproduce
Error Message