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

Commitfe12f2f

Browse files
committed
Fix generate_partitionwise_join_paths() to tolerate failure.
We might fail to generate a partitionwise join, becausereparameterize_path_by_child() does not support all path types.This should not be a hard failure condition: we should just fall backto a non-partitioned join. However, generate_partitionwise_join_pathsdid not consider this possibility and would emit the (misleading)error "could not devise a query plan for the given query" if we'dfailed to make any paths for a child join. Fix it to give up onpartitionwise joining if so. (The accepted technique for giving upappears to be to set rel->nparts = 0, which I find pretty bizarre,but there you have it.)I have not added a test case because there'd be little point:any omissions of this sort that we identify would soon get fixedby extending reparameterize_path_by_child(), so the test would stopproving anything. However, right now there is a known test case basedon failure to cover MaterialPath, and with that I've found that thisis broken in all supported versions. Hence, patch all the way back.Original report and patch by me; thanks to Richard Guo foridentifying a test case that works against committed versions.Discussion:https://postgr.es/m/1854233.1669949723@sss.pgh.pa.us
1 parent6b423ec commitfe12f2f

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

‎src/backend/optimizer/path/allpaths.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4273,12 +4273,24 @@ generate_partitionwise_join_paths(PlannerInfo *root, RelOptInfo *rel)
42734273
if (child_rel==NULL)
42744274
continue;
42754275

4276-
/*Add partitionwise join paths for partitioned child-joins. */
4276+
/*Make partitionwise join paths forthispartitioned child-join. */
42774277
generate_partitionwise_join_paths(root,child_rel);
42784278

4279+
/* If we failed to make any path for this child, we must give up. */
4280+
if (child_rel->pathlist==NIL)
4281+
{
4282+
/*
4283+
* Mark the parent joinrel as unpartitioned so that later
4284+
* functions treat it correctly.
4285+
*/
4286+
rel->nparts=0;
4287+
return;
4288+
}
4289+
4290+
/* Else, identify the cheapest path for it. */
42794291
set_cheapest(child_rel);
42804292

4281-
/* Dummy childrenwill not be scanned, so ignore those. */
4293+
/* Dummy childrenneed not be scanned, so ignore those. */
42824294
if (IS_DUMMY_REL(child_rel))
42834295
continue;
42844296

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp