1
0
mirror of https://github.com/postgres/postgres.git synced 2025-04-22 23:02:54 +03:00

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 6f6b99d13.
It might be unreachable in v10, but I have little faith in that
proposition, so back-patch.

Per buildfarm.
This commit is contained in:
Tom Lane 2017-09-08 19:04:32 -04:00
parent f25000c832
commit e56dd7cf50

View File

@ -1120,11 +1120,11 @@ map_partition_varattnos(List *expr, int target_varno,
Relation partrel, Relation parent,
bool *found_whole_row)
{
AttrNumber *part_attnos;
bool my_found_whole_row;
bool my_found_whole_row = false;
if (expr == NIL)
return NIL;
if (expr != NIL)
{
AttrNumber *part_attnos;
part_attnos = convert_tuples_by_name_map(RelationGetDescr(partrel),
RelationGetDescr(parent),
@ -1135,6 +1135,8 @@ map_partition_varattnos(List *expr, int target_varno,
RelationGetDescr(parent)->natts,
RelationGetForm(partrel)->reltype,
&my_found_whole_row);
}
if (found_whole_row)
*found_whole_row = my_found_whole_row;