Skip to content

Commit e56dd7c

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 f25000c commit e56dd7c

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
@@ -1120,21 +1120,23 @@ map_partition_varattnos(List *expr, int target_varno,
11201120
Relation partrel, Relation parent,
11211121
bool *found_whole_row)
11221122
{
1123-
AttrNumber *part_attnos;
1124-
bool my_found_whole_row;
1123+
bool my_found_whole_row = false;
11251124

1126-
if (expr == NIL)
1127-
return NIL;
1125+
if (expr != NIL)
1126+
{
1127+
AttrNumber *part_attnos;
1128+
1129+
part_attnos = convert_tuples_by_name_map(RelationGetDescr(partrel),
1130+
RelationGetDescr(parent),
1131+
gettext_noop("could not convert row type"));
1132+
expr = (List *) map_variable_attnos((Node *) expr,
1133+
target_varno, 0,
1134+
part_attnos,
1135+
RelationGetDescr(parent)->natts,
1136+
RelationGetForm(partrel)->reltype,
1137+
&my_found_whole_row);
1138+
}
11281139

1129-
part_attnos = convert_tuples_by_name_map(RelationGetDescr(partrel),
1130-
RelationGetDescr(parent),
1131-
gettext_noop("could not convert row type"));
1132-
expr = (List *) map_variable_attnos((Node *) expr,
1133-
target_varno, 0,
1134-
part_attnos,
1135-
RelationGetDescr(parent)->natts,
1136-
RelationGetForm(partrel)->reltype,
1137-
&my_found_whole_row);
11381140
if (found_whole_row)
11391141
*found_whole_row = my_found_whole_row;
11401142

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