Skip to content

Commit 1377b40

Browse files
committed
Fix uninitialized-variable bug.
map_partition_varattnos() failed to set its found_whole_row output parameter if the given expression list was NIL. This seems to be a pre-existing bug that chanced to be exposed by commit 6f6b99d. It might be unreachable in v10, but I have little faith in that proposition, so back-patch. Per buildfarm.
1 parent 5f0ac02 commit 1377b40

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

src/backend/catalog/partition.c

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -916,21 +916,23 @@ map_partition_varattnos(List *expr, int target_varno,
916916
Relation partrel, Relation parent,
917917
bool *found_whole_row)
918918
{
919-
AttrNumber *part_attnos;
920-
bool my_found_whole_row;
919+
bool my_found_whole_row = false;
921920

922-
if (expr == NIL)
923-
return NIL;
921+
if (expr != NIL)
922+
{
923+
AttrNumber *part_attnos;
924+
925+
part_attnos = convert_tuples_by_name_map(RelationGetDescr(partrel),
926+
RelationGetDescr(parent),
927+
gettext_noop("could not convert row type"));
928+
expr = (List *) map_variable_attnos((Node *) expr,
929+
target_varno, 0,
930+
part_attnos,
931+
RelationGetDescr(parent)->natts,
932+
RelationGetForm(partrel)->reltype,
933+
&my_found_whole_row);
934+
}
924935

925-
part_attnos = convert_tuples_by_name_map(RelationGetDescr(partrel),
926-
RelationGetDescr(parent),
927-
gettext_noop("could not convert row type"));
928-
expr = (List *) map_variable_attnos((Node *) expr,
929-
target_varno, 0,
930-
part_attnos,
931-
RelationGetDescr(parent)->natts,
932-
RelationGetForm(partrel)->reltype,
933-
&my_found_whole_row);
934936
if (found_whole_row)
935937
*found_whole_row = my_found_whole_row;
936938

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy