Issue found by SQLSmith on git commit hash aef7b using seed 310077765.
To Reproduce
call dbgen(sf=0.1);
SELECT CASE WHEN (EXISTS(SELECT ref_3.n_comment AS c0, ref_3.n_regionkey AS c1, ref_3.n_comment AS c2 FROM main.nation AS ref_3 INNER JOIN main.region AS ref_4 ON ((ref_3.n_regionkey = ref_4.r_regionkey)) WHERE EXISTS(SELECT ref_6.p_size AS c0, ref_4.r_comment AS c1, ref_3.n_nationkey AS c2, ref_3.n_regionkey AS c3, ref_5.p_brand AS c4, subq_2.c7 AS c5, ref_5.p_name AS c6, ref_5.p_type AS c7, ref_4.r_name AS c8, ref_6.p_partkey AS c9, ref_4.r_comment AS c10, ref_3.n_regionkey AS c11, ref_5.p_partkey AS c12, ref_4.r_comment AS c13, ref_5.p_size AS c14, subq_2.c2 AS c15, ref_4.r_name AS c16, subq_2.c8 AS c17, ref_4.r_regionkey AS c18, 18 AS c19 FROM main.part AS ref_5 INNER JOIN main.part AS ref_6 ON (EXISTS(SELECT subq_2.c8 AS c0, ref_4.r_comment AS c1, ref_3.n_nationkey AS c2, ref_5.p_container AS c3, ref_3.n_name AS c4, ref_6.p_retailprice AS c5, ref_7.ps_comment AS c6 FROM main.partsupp AS ref_7 WHERE 0)) WHERE 1 LIMIT 77) LIMIT 143)) THEN (get_current_time()) ELSE get_current_time() END AS c0, CASE WHEN (((SELECT l_returnflag FROM main.lineitem LIMIT 1 OFFSET 38) ^@ subq_2.c10)) THEN (subq_2.c4) ELSE subq_2.c4 END AS c1 FROM (SELECT subq_0.c1 AS c0, subq_0.c8 AS c1, subq_0.c2 AS c2, subq_0.c1 AS c3, subq_0.c6 AS c4, subq_1.c3 AS c5, subq_1.c3 AS c6, subq_1.c3 AS c7, CASE WHEN ((subq_0.c7 !~~* subq_0.c7)) THEN (subq_0.c6) ELSE subq_0.c6 END AS c8, subq_0.c1 AS c9, subq_0.c2 AS c10, subq_0.c6 AS c11, subq_0.c6 AS c12, current_date() AS c13, subq_0.c1 AS c14, subq_0.c8 AS c15, subq_1.c3 AS c16 FROM (SELECT ref_0.l_returnflag AS c0, ref_0.l_commitdate AS c1, (SELECT n_comment FROM main.nation LIMIT 1 OFFSET 5) AS c2, ref_0.l_linenumber AS c3, ref_0.l_commitdate AS c4, ref_0.l_discount AS c5, ref_0.l_suppkey AS c6, ref_0.l_comment AS c7, ref_0.l_receiptdate AS c8 FROM main.lineitem AS ref_0 WHERE (ref_0.l_linestatus ~~ ref_0.l_shipinstruct)) AS subq_0 , (SELECT ref_1.s_suppkey AS c0, subq_0.c8 AS c1, ref_1.s_suppkey AS c2, subq_0.c8 AS c3 FROM main.supplier AS ref_1 WHERE EXISTS(SELECT subq_0.c6 AS c0, (SELECT ps_availqty FROM main.partsupp LIMIT 1 OFFSET 78) AS c1, (SELECT n_name FROM main.nation LIMIT 1 OFFSET 3) AS c2 FROM main.orders AS ref_2 WHERE ((CAST(NULL AS VARCHAR) !~~ ref_2.o_orderpriority) OR (CAST(NULL AS VARCHAR) ~~~ ref_2.o_orderpriority)) LIMIT 75)) AS subq_1 WHERE (0 OR (current_database() !~~ subq_0.c7)) LIMIT 19) AS subq_2 WHERE (regexp_escape(CAST(CAST("nullif"(subq_2.c2, subq_2.c2) AS VARCHAR) AS VARCHAR)) !~~* subq_2.c2) LIMIT 71
Issue found by SQLSmith on git commit hash aef7b using seed 310077765.
To Reproduce
Error Message