Issue found by SQLSmith on git commit hash 50bb6 using seed 846618573.
To Reproduce
create table all_types as select * exclude(small_enum, medium_enum, large_enum) from test_all_types();
SELECT EXISTS(SELECT NULL FROM main.all_types INNER JOIN main.all_types AS ref_10 ON (EXISTS(SELECT NULL FROM main.all_types , (SELECT subq_0.c0 AS c2, ref_10.dec38_10 AS c5 WHERE 0)))) FROM (SELECT ref_8."varchar" AS c0 FROM main.all_types AS ref_0 LEFT JOIN main.all_types AS ref_1 LEFT JOIN main.all_types AS ref_2 LEFT JOIN main.all_types AS ref_3 ON ((ref_2."map" IS NOT NULL)) RIGHT JOIN main.all_types AS ref_4 INNER JOIN main.all_types AS ref_5 ON (EXISTS(SELECT ref_5."union" AS c0, ref_6.dec_9_4 AS c1, (SELECT "interval" FROM main.all_types LIMIT 1 OFFSET 1) AS c2, ref_6."smallint" AS c3 FROM main.all_types AS ref_6 WHERE 0 LIMIT 156)) ON ((ref_2."varchar" !~~* ref_3."varchar")) ON ((ref_1.timestamp_tz = ref_2.timestamp_tz)) ON ((ref_2."varchar" ~~* ref_5."varchar")) RIGHT JOIN main.all_types AS ref_7 INNER JOIN main.all_types AS ref_8 ON ((ref_7."varchar" !~~ ref_8."varchar")) ON ((ref_4.fixed_struct_array IS NOT NULL)) LIMIT 125) AS subq_0
Error Message
ABORT THROWN BY INTERNAL EXCEPTION: Failed to bind column reference "c5" [35.0] (bindings: {#[34.0], #[62.0]})
Issue found by SQLSmith on git commit hash 50bb6 using seed 846618573.
To Reproduce
Error Message