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

Commit10e3991

Browse files
committed
Clean up side-effects of commitsab5fcf2 et al.
Before those commits, partitioning-related code in the executor couldassume that ModifyTableState.resultRelInfo[] contains only leaf partitions.However, now a fully-pruned update results in a dummy ModifyTable thatreferences the root partitioned table, and that breaks some stuff.In v11, this led to an assertion or core dump in the tuple routing code.Fix by disabling tuple routing, since we don't need that anyway.(I chose to do that in HEAD as well for safety, even though the problemdoesn't manifest in HEAD as it stands.)In v10, this confused ExecInitModifyTable's decision about whether itneeded to close the root table. But we can get rid of that altogetherby being smarter about where to find the root table.Note that since the referenced commits haven't shipped yet, thisisn't fixing any bug the field has seen.Amit Langote, per a report from meDiscussion:https://postgr.es/m/20710.1554582479@sss.pgh.pa.us
1 parentc2a5fb3 commit10e3991

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1599,6 +1599,15 @@ inheritance_planner(PlannerInfo *root)
15991599
withCheckOptionLists=list_make1(parse->withCheckOptions);
16001600
if (parse->returningList)
16011601
returningLists=list_make1(parse->returningList);
1602+
1603+
/*
1604+
* Since no tuples will be updated, don't require ModifyTable to
1605+
* create tuple-routing info that will be left unused. In fact it's
1606+
* necessary to do so, because we're cheating here by putting the root
1607+
* table into resultRelations list, which the tuple-routing code is
1608+
* not expecting to be there.
1609+
*/
1610+
root->partColsUpdated= false;
16021611
}
16031612
else
16041613
{

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -665,6 +665,15 @@ select tableoid::regclass::text as relname, parted_tab.* from parted_tab order b
665665
parted_tab_part3 | 3 | a
666666
(3 rows)
667667

668+
-- modifies partition key, but no rows will actually be updated
669+
explain update parted_tab set a = 2 where false;
670+
QUERY PLAN
671+
--------------------------------------------------------
672+
Update on parted_tab (cost=0.00..0.00 rows=0 width=0)
673+
-> Result (cost=0.00..0.00 rows=0 width=0)
674+
One-Time Filter: false
675+
(3 rows)
676+
668677
drop table parted_tab;
669678
-- Check UPDATE with multi-level partitioned inherited target
670679
create table mlparted_tab (a int, b char, c text) partition by list (a);

‎src/test/regress/sql/inherit.sql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,9 @@ from
168168
whereparted_tab.a=ss.a;
169169
select tableoid::regclass::textas relname, parted_tab.*from parted_taborder by1,2;
170170

171+
-- modifies partition key, but no rows will actually be updated
172+
explainupdate parted_tabset a=2where false;
173+
171174
droptable parted_tab;
172175

173176
-- Check UPDATE with multi-level partitioned inherited target

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp