Issue found by SQLSmith on git commit hash aef7b using seed 865394126.
To Reproduce
call dbgen(sf=0.1);
SELECT NULL FROM main.lineitem AS ref_0 INNER JOIN main.partsupp AS ref_1 INNER JOIN main.region AS ref_2 ON ((ref_2.r_comment ^@ ref_2.r_comment)) INNER JOIN main.customer AS ref_3 ON (EXISTS(SELECT subq_1.c3 AS c0, subq_1.c3 AS c1, ref_4.l_quantity AS c2, ref_1.ps_availqty AS c3, subq_1.c0 AS c4, subq_1.c2 AS c5, ref_2.r_comment AS c6, subq_1.c0 AS c7, ref_3.c_nationkey AS c8, ref_1.ps_supplycost AS c9, ref_3.c_mktsegment AS c10 FROM main.lineitem AS ref_4 , (SELECT ref_5.r_name AS c0, ref_3.c_name AS c1, ref_2.r_name AS c2, ref_2.r_name AS c3 FROM main.region AS ref_5 WHERE EXISTS(SELECT ref_6.l_linenumber AS c0, ref_3.c_comment AS c1 FROM main.lineitem AS ref_6 , (SELECT ref_3.c_acctbal AS c0 FROM main.nation AS ref_7 WHERE (CAST(NULL AS VARCHAR) ^@ ref_3.c_name) LIMIT 110) AS subq_0 WHERE (ref_2.r_comment ~~~ ref_6.l_shipmode) LIMIT 41) LIMIT 134) AS subq_1 WHERE (((SELECT o_orderstatus FROM main.orders LIMIT 1 OFFSET 4) ~~~ ref_3.c_comment) AND ((ref_4.l_tax IS NULL) OR (ref_4.l_linestatus ^@ ref_4.l_comment))) LIMIT 56)) ON ((ref_0.l_shipinstruct !~~* regexp_replace(CAST(ref_3.c_comment AS VARCHAR), CAST(ref_2.r_name AS VARCHAR), CAST(ref_3.c_comment AS VARCHAR)))) INNER JOIN (SELECT ref_9.s_phone AS c0, ref_8.r_regionkey AS c1, ref_9.s_phone AS c2 FROM main.region AS ref_8 RIGHT JOIN main.supplier AS ref_9 ON ((1 AND (ref_9.s_comment ~~ ref_9.s_address) AND 0 AND (ref_9.s_name !~~ ref_9.s_name))) LEFT JOIN main.customer AS ref_10 ON ((ref_10.c_address ~~* ref_10.c_comment)) WHERE (ref_9.s_phone IS NOT NULL) LIMIT 53) AS subq_2 ON ((CASE WHEN (1) THEN (subq_2.c2) ELSE subq_2.c2 END !~~ ref_1.ps_comment))
Error Message
ABORT THROWN BY INTERNAL EXCEPTION: Failed to bind column reference "c0" [57.0] (bindings: {#[5.0], #[20.0], #[20.1], #[20.2], #[20.3], #[20.4]})
Issue found by SQLSmith on git commit hash aef7b using seed 865394126.
To Reproduce
Error Message