Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commiteae0e20

Browse files
committed
Remove over-optimistic Assert.
In commit2489d76, I'd thought it'd be safe to assert that aPlaceHolderVar appearing in a scan-level expression has emptynullingrels. However this is not so, as when we determine that ajoin relation is certainly empty we'll put its targetlist into aResult-with-constant-false-qual node, and nothing is done to adjustthe nullingrels of the Vars or PHVs therein. (Arguably, a Resultused in this way isn't really a scan-level node, but it certainlyisn't an upper node either ...)It's not clear this is worth any close analysis, so let's justtake out the faulty Assert.Per report from Robins Tharakan. I added a test case based onhis example, just in case somebody tries to tighten this up.Discussion:https://postgr.es/m/CAEP4nAz7Enq3+DEthGG7j27DpuwSRZnW0Nh6jtNh75yErQ_nbA@mail.gmail.com
1 parent3db72eb commiteae0e20

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

‎src/backend/optimizer/plan/setrefs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2205,7 +2205,7 @@ fix_scan_expr_mutator(Node *node, fix_scan_expr_context *context)
22052205
/* At scan level, we should always just evaluate the contained expr */
22062206
PlaceHolderVar*phv= (PlaceHolderVar*)node;
22072207

2208-
Assert(phv->phnullingrels==NULL);
2208+
/* XXX can we assert something about phnullingrels? */
22092209
returnfix_scan_expr_mutator((Node*)phv->phexpr,context);
22102210
}
22112211
if (IsA(node,AlternativeSubPlan))

‎src/test/regress/expected/join.out

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3599,6 +3599,20 @@ where f1 in ( select c3.f1 from ctetable c2 full join ctetable c3 on true );
35993599
1
36003600
(1 row)
36013601

3602+
-- Test PHV that winds up in a Result node, despite having nonempty nullingrels
3603+
explain (verbose, costs off)
3604+
select table_catalog, table_name
3605+
from int4_tbl t1
3606+
inner join (int8_tbl t2
3607+
left join information_schema.column_udt_usage on null)
3608+
on null;
3609+
QUERY PLAN
3610+
-------------------------------------------------------------------------------------------------------------------
3611+
Result
3612+
Output: (current_database())::information_schema.sql_identifier, (c.relname)::information_schema.sql_identifier
3613+
One-Time Filter: false
3614+
(3 rows)
3615+
36023616
--
36033617
-- test inlining of immutable functions
36043618
--

‎src/test/regress/sql/join.sql

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1181,6 +1181,14 @@ with ctetable as not materialized ( select 1 as f1 )
11811181
select*from ctetable c1
11821182
where f1in (selectc3.f1from ctetable c2 fulljoin ctetable c3on true );
11831183

1184+
-- Test PHV that winds up in a Result node, despite having nonempty nullingrels
1185+
explain (verbose, costs off)
1186+
select table_catalog, table_name
1187+
from int4_tbl t1
1188+
inner join (int8_tbl t2
1189+
left joininformation_schema.column_udt_usageonnull)
1190+
onnull;
1191+
11841192
--
11851193
-- test inlining of immutable functions
11861194
--

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp