Thanks for the report! Unfortunately, the stack trace was not informative, because there are no debug symbols. Here's a minimal reproducer, which also traps an assertion on PG13. I'll bisect and see how far back it goes.
SELECT v1 FROM LATERAL COALESCE (27) v1
WHERE v1 IN (
SELECT 42 as v1
);
TRAP: FailedAssertion("false", File: "prepjointree.c", Line: 2164, PID: 1322)
0 postgres 0x000000010e78ecd4 ExceptionalCondition + 132
1 postgres 0x000000010e589d85 replace_vars_in_jointree + 613
2 postgres 0x000000010e589c94 replace_vars_in_jointree + 372
3 postgres 0x000000010e589c24 replace_vars_in_jointree + 260
4 postgres 0x000000010e589c94 replace_vars_in_jointree + 372
5 postgres 0x000000010e5899e7 perform_pullup_replace_vars + 199
6 postgres 0x000000010e587382 pull_up_subqueries_recurse + 1954
7 postgres 0x000000010e586ea4 pull_up_subqueries_recurse + 708
8 postgres 0x000000010e586e09 pull_up_subqueries_recurse + 553
9 postgres 0x000000010e586b75 pull_up_subqueries + 37
10 postgres 0x000000010e5761ed subquery_planner + 573
11 postgres 0x000000010e5759c7 standard_planner + 359
12 postgres 0x000000010e65a39f pg_plan_query + 111
13 postgres 0x000000010e65a462 pg_plan_queries + 82
14 postgres 0x000000010e65e9d2 exec_simple_query + 1154
--
John Naylor
EDB:
http://www.enterprisedb.com