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

Commit159970b

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 parent03f9e5c commit159970b

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1732,6 +1732,8 @@ inheritance_planner(PlannerInfo *root)
17321732
withCheckOptionLists=list_make1(parse->withCheckOptions);
17331733
if (parse->returningList)
17341734
returningLists=list_make1(parse->returningList);
1735+
/* Disable tuple routing, too, just to be safe */
1736+
root->partColsUpdated= false;
17351737
}
17361738
else
17371739
{

‎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