Issue found by SQLSmith on git commit hash 50bb6 using seed 343016847.
To Reproduce
call dbgen(sf=0.1);
SELECT NULL FROM main.customer INNER JOIN (SELECT ref_5.s_phone AS c0, ref_2.r_comment AS c1 FROM main.region AS ref_1 RIGHT JOIN main.region AS ref_2 ON ((ref_2.r_regionkey IS NULL)) RIGHT JOIN main.region AS ref_3 ON (((ref_2.r_comment ~~~ ref_3.r_name) OR (ref_1.r_name ~~ ref_2.r_name))) INNER JOIN main.orders AS ref_4 INNER JOIN main.supplier AS ref_5 INNER JOIN main.supplier AS ref_6 ON ((ref_5.s_acctbal IS NULL)) ON ((ref_4.o_comment IS NOT NULL)) ON ((ref_2.r_regionkey = ref_6.s_nationkey)) WHERE EXISTS(SELECT ref_5.s_comment AS c0, ref_6.s_acctbal AS c1, ref_4.o_comment AS c2 FROM main.part AS ref_7 WHERE (CAST(NULL AS VARCHAR) ~~* ref_2.r_name) LIMIT 30)) AS subq_0 ON ((subq_0.c1 IS NOT NULL))
Error Message
ABORT THROWN BY INTERNAL EXCEPTION: Failed to bind column reference "c1" [6.1] (bindings: {#[5.0], #[5.1], #[5.2]})
Issue found by SQLSmith on git commit hash 50bb6 using seed 343016847.
To Reproduce
Error Message