citus
citus copied to clipboard
Non-colocated subquery planning fails with `unrecognized node type`
Generated by sqlsmith
select
subq_1.c1 as c0,
subq_1.c3 as c1,
(select object_names from citus.pg_dist_object limit 1 offset 1)
as c2,
subq_1.c2 as c3,
subq_1.c5 as c4,
subq_1.c2 as c5,
case when case when cast(null as box) |>> case when cast(null as "interval") >= cast(null as "interval") then cast(null as box) else cast(null as box) end
then cast(nullif(case when (subq_1.c5 is not NULL)
and ((select pg_catalog.stddev(value_4) from public.events_table_ref)
is NULL) then cast(null as bpchar) else cast(null as bpchar) end
,
cast(null as bpchar)) as bpchar) else cast(nullif(case when (subq_1.c5 is not NULL)
and ((select pg_catalog.stddev(value_4) from public.events_table_ref)
is NULL) then cast(null as bpchar) else cast(null as bpchar) end
,
cast(null as bpchar)) as bpchar) end
~ subq_1.c0 then pg_catalog.pg_replication_origin_session_is_setup() else pg_catalog.pg_replication_origin_session_is_setup() end
as c6,
pg_catalog.pg_current_wal_insert_lsn() as c7
from
(select
sample_1.message as c0,
(select id from public.notices limit 1 offset 1)
as c1,
sample_1.id as c2,
sample_1.id as c3,
ref_1.event_type as c4,
sample_0.id as c5,
ref_1.y as c6
from
public.users_table_ref as ref_0
inner join public.notices as sample_0 tablesample system (5.7)
on (true)
inner join public.events_table as ref_1
inner join public.notices as sample_1 tablesample bernoulli (6.7)
on (ref_1.value_3 is not NULL)
on (ref_0.value_2 < ref_1.user_id),
lateral (select
ref_0.value_3 as c0,
ref_0.value_3 as c1,
ref_1.value_3 as c2,
sample_0.message as c3
from
public.events_table as ref_2
where ((ref_1.value_3 <> cast(null as float4))
or (ref_0.time is NULL))
or (false)
limit 129) as subq_0
where cast(nullif(case when (select object_names from citus.pg_dist_object limit 1 offset 4)
<@ cast(null as _text) then cast(null as name) else cast(null as name) end
,
cast(null as name)) as name) ~~* cast(null as text)
limit 81) as subq_1
where (EXISTS (
select
sample_2.value_2 as c0,
sample_2.value_2 as c1
from
public.events_table as sample_2 tablesample system (8.5)
where cast(null as int2) <= pg_catalog.int2um(
cast(cast(null as int2) as int2))
limit 25))
or (cast(null as "char") <> case when false then cast(null as "char") else cast(null as "char") end
)
limit 104;
ERROR: unrecognized node type: 228
* frame #0: 0x000000010c6df803 postgres`errstart(elevel=20, filename="nodeFuncs.c", lineno=2234, funcname="expression_tree_walker", domain=0x0000000000000000) at elog.c:251:7
frame #1: 0x000000010c6e2130 postgres`elog_finish(elevel=20, fmt="unrecognized node type: %d") at elog.c:1358:7
frame #2: 0x000000010c4cf688 postgres`expression_tree_walker(node=0x000000011765b838, walker=(citus.so`ExtractRangeTableList at query_utils.c:31), context=0x00007ffee3934e80) at nodeFuncs.c:2233:4
frame #3: 0x000000010cedcbec citus.so`ExtractRangeTableRelationWalker(node=<unavailable>, rangeTableRelationList=<unavailable>) at query_utils.c:131:9
frame #4: 0x000000010cec1b8c citus.so`QueryRteIdentities(queryTree=<unavailable>) at relation_restriction_equivalence.c:1931:2
frame #5: 0x000000010cec1af9 citus.so`FilterPlannerRestrictionForQuery(plannerRestrictionContext=0x0000000117583520, query=<unavailable>) at relation_restriction_equivalence.c:1749:30
frame #6: 0x000000010cebde6f citus.so`CreateColocatedJoinChecker(subquery=0x000000010d063b30, restrictionContext=0x0000000117583520) at query_colocation_checker.c:84:3
frame #7: 0x000000010cec0789 citus.so`RecursivelyPlanNonColocatedSubqueries(subquery=0x000000010d063b30, context=0x00007ffee3935090) at recursive_planning.c:436:46
frame #8: 0x000000010cebfb9f citus.so`RecursivelyPlanSubqueriesAndCTEs(query=0x000000010d063b30, context=0x00007ffee3935090) at recursive_planning.c:340:3
frame #9: 0x000000010cec04c8 citus.so`RecursivelyPlanSubqueryWalker(node=0x000000010d063b30, context=0x00007ffee3935090) at recursive_planning.c:849:33
frame #10: 0x000000010c4cfda8 postgres`range_table_walker(rtable=<unavailable>, walker=(citus.so`RecursivelyPlanSubqueryWalker at recursive_planning.c:833), context=0x00007ffee3935090, flags=0) at nodeFuncs.c:0:21
frame #11: 0x000000010c4cfcd3 postgres`query_tree_walker(query=0x00007f8823080300, walker=(citus.so`RecursivelyPlanSubqueryWalker at recursive_planning.c:833), context=0x00007ffee3935090, flags=0) at nodeFuncs.c:2288:7
frame #12: 0x000000010cebfaee citus.so`RecursivelyPlanSubqueriesAndCTEs(query=0x00007f8823080300, context=0x00007ffee3935090) at recursive_planning.c:294:2
frame #13: 0x000000010cebf9fa citus.so`GenerateSubplansForSubqueriesAndCTEs(planId=7, originalQuery=0x00007f8823080300, plannerRestrictionContext=<unavailable>) at recursive_planning.c:228:32
frame #14: 0x000000010cea7dd3 citus.so`CreateDistributedPlan(planId=7, originalQuery=0x00007f8823080300, query=0x00007f8823080418, boundParams=0x0000000000000000, hasUnresolvedParams=<unavailable>, plannerRestrictionContext=0x0000000117583520) at distributed_planner.c:1019:22
frame #15: 0x000000010cea7a7a citus.so`CreateDistributedPlannedStmt(planContext=0x00007ffee39351c0) at distributed_planner.c:705:3
frame #16: 0x000000010cea6a1e citus.so`PlanDistributedStmt(planContext=0x00007ffee39351c0, rteIdCounter=<unavailable>) at distributed_planner.c:636:24
frame #17: 0x000000010cea6560 citus.so`distributed_planner(parse=0x00007f8823080418, cursorOptions=<unavailable>, boundParams=<unavailable>) at distributed_planner.c:263:14
frame #18: 0x000000010c5decf8 postgres`pg_plan_query(querytree=0x00007f8823080418, cursorOptions=256, boundParams=0x0000000000000000) at postgres.c:832:9
frame #19: 0x000000010c5dee1e postgres`pg_plan_queries(querytrees=<unavailable>, cursorOptions=256, boundParams=0x0000000000000000) at postgres.c:898:11
frame #20: 0x000000010c5e0f1e postgres`exec_simple_query(query_string="select \n subq_1.c1 as c0, \n subq_1.c3 as c1, \n (select object_names from citus.pg_dist_object limit 1 offset 1)\n as c2, \n subq_1.c2 as c3, \n subq_1.c5 as c4, \n subq_1.c2 as c5, \n case when case when cast(null as box) |>> case when cast(null as \"interval\") >= cast(null as \"interval\") then cast(null as box) else cast(null as box) end\n then cast(nullif(case when (subq_1.c5 is not NULL) \n and ((select pg_catalog.stddev(value_4) from public.events_table_ref)\n is NULL) then cast(null as bpchar) else cast(null as bpchar) end\n ,\n cast(null as bpchar)) as bpchar) else cast(nullif(case when (subq_1.c5 is not NULL) \n and ((select pg_catalog.stddev(value_4) from public.events_table_ref)\n is NULL) then cast(null as bpchar) else cast(null as bpchar) end\n ,\n cast(null as bpchar)) as bpchar) end\n ~ subq_1.c0 then pg_catalog.pg_replication_origin_session_is_setup() else pg_catalog.pg_replicatio"...) at postgres.c:1073:19
frame #21: 0x000000010c5e0664 postgres`PostgresMain(argc=<unavailable>, argv=<unavailable>, dbname=<unavailable>, username=<unavailable>) at postgres.c:0:11
frame #22: 0x000000010c5646da postgres`BackendRun(port=0x000000010c898ce1) at postmaster.c:4358:2
frame #23: 0x000000010c563f60 postgres`BackendStartup(port=<unavailable>) at postmaster.c:4030:3
frame #24: 0x000000010c5634e2 postgres`ServerLoop at postmaster.c:1707:7
frame #25: 0x000000010c561435 postgres`PostmasterMain(argc=3, argv=0x00007f8822c03150) at postmaster.c:1380:11
frame #26: 0x000000010c4cd026 postgres`main(argc=3, argv=0x00007f8822c03150) at main.c:228:3
frame #27: 0x00007fff7df743d5 libdyld.dylib`start + 1
frame #28: 0x00007fff7df743d5 libdyld.dylib`start + 1