diff --git a/src/backend/optimizer/plan/setrefs.c b/src/backend/optimizer/plan/setrefs.c index 4348bfef60..186fc8014b 100644 --- a/src/backend/optimizer/plan/setrefs.c +++ b/src/backend/optimizer/plan/setrefs.c @@ -2205,7 +2205,7 @@ fix_scan_expr_mutator(Node *node, fix_scan_expr_context *context) /* At scan level, we should always just evaluate the contained expr */ PlaceHolderVar *phv = (PlaceHolderVar *) node; - Assert(phv->phnullingrels == NULL); + /* XXX can we assert something about phnullingrels? */ return fix_scan_expr_mutator((Node *) phv->phexpr, context); } if (IsA(node, AlternativeSubPlan)) diff --git a/src/test/regress/expected/join.out b/src/test/regress/expected/join.out index 87e1276804..e73ba93ca3 100644 --- a/src/test/regress/expected/join.out +++ b/src/test/regress/expected/join.out @@ -3599,6 +3599,20 @@ where f1 in ( select c3.f1 from ctetable c2 full join ctetable c3 on true ); 1 (1 row) +-- Test PHV that winds up in a Result node, despite having nonempty nullingrels +explain (verbose, costs off) +select table_catalog, table_name +from int4_tbl t1 + inner join (int8_tbl t2 + left join information_schema.column_udt_usage on null) + on null; + QUERY PLAN +------------------------------------------------------------------------------------------------------------------- + Result + Output: (current_database())::information_schema.sql_identifier, (c.relname)::information_schema.sql_identifier + One-Time Filter: false +(3 rows) + -- -- test inlining of immutable functions -- diff --git a/src/test/regress/sql/join.sql b/src/test/regress/sql/join.sql index 2bb24dbfcd..ed26ffd8a8 100644 --- a/src/test/regress/sql/join.sql +++ b/src/test/regress/sql/join.sql @@ -1181,6 +1181,14 @@ with ctetable as not materialized ( select 1 as f1 ) select * from ctetable c1 where f1 in ( select c3.f1 from ctetable c2 full join ctetable c3 on true ); +-- Test PHV that winds up in a Result node, despite having nonempty nullingrels +explain (verbose, costs off) +select table_catalog, table_name +from int4_tbl t1 + inner join (int8_tbl t2 + left join information_schema.column_udt_usage on null) + on null; + -- -- test inlining of immutable functions --