git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f25000c)
Fix uninitialized-variable bug.
Fri, 8 Sep 2017 23:04:32 +0000 (19:04 -0400)
Fri, 8 Sep 2017 23:04:32 +0000 (19:04 -0400)
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.


diff --git a/src/backend/catalog/partition.c b/src/backend/catalog/partition.c
index 7e426ba9c8813c11f15a748167925332b4b5ca27..c94ee941ded1d5e863b744874ad183ccd175e993 100644 (file)
--- a/src/backend/catalog/partition.c
+++ b/src/backend/catalog/partition.c
@@ -1120,21 +1120,23 @@ 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),
+ gettext_noop("could not convert row type"));
+ expr = (List *) map_variable_attnos((Node *) expr,
+ target_varno, 0,
+ part_attnos,
+ RelationGetDescr(parent)->natts,
+ RelationGetForm(partrel)->reltype,
+ &my_found_whole_row);
+ }
- part_attnos = convert_tuples_by_name_map(RelationGetDescr(partrel),
- RelationGetDescr(parent),
- gettext_noop("could not convert row type"));
- expr = (List *) map_variable_attnos((Node *) expr,
- target_varno, 0,
- part_attnos,
- RelationGetDescr(parent)->natts,
- RelationGetForm(partrel)->reltype,
- &my_found_whole_row);
if (found_whole_row)
*found_whole_row = my_found_whole_row;
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /