Issue found by SQLSmith on git commit hash dd9e6 using seed 1000239749.
To Reproduce
create table all_types as select * exclude(small_enum, medium_enum, large_enum) from test_all_types() limit 0;
SELECT NULL FROM (SELECT ref_1.timestamp_tz AS c1 FROM main.all_types AS ref_0 INNER JOIN main.all_types AS ref_1 RIGHT JOIN main.all_types AS ref_2 ON (ref_2."varchar") INNER JOIN main.all_types ON (ref_1."varchar") RIGHT JOIN main.all_types AS ref_4 INNER JOIN main.all_types AS ref_5 ON (ref_4."varchar") ON ((ref_2."timestamp" = ref_4."timestamp")) RIGHT JOIN main.all_types AS ref_6 ON (NULL) ON (EXISTS(SELECT ref_4.bool AS c0, ref_2.dec_4_1 AS c1, ref_0.fixed_nested_int_array AS c2 FROM main.all_types AS ref_7 , (SELECT ref_2.fixed_nested_int_array AS c0 WHERE NULL LIMIT 140) LIMIT 27)) LIMIT 146) LIMIT 183
Issue found by SQLSmith on git commit hash dd9e6 using seed 1000239749.
To Reproduce
Error Message