Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
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)