From: Andres Freund Date: Tue, 1 Apr 2014 17:22:53 +0000 (+0200) Subject: bdr: Simplify logic for generating the primary key during updates. X-Git-Url: http://waps.l3s.uni-hannover.de/gitweb/?a=commitdiff_plain;h=bb5c66fc74b48391984930d0602e3023b19867c9;p=users%2Fandresfreund%2Fpostgres.git bdr: Simplify logic for generating the primary key during updates. That hopefully gets rid of compiler warnings on older gccs. --- diff --git a/contrib/bdr/bdr_apply.c b/contrib/bdr/bdr_apply.c index 62393ca7f3..5f75625d98 100644 --- a/contrib/bdr/bdr_apply.c +++ b/contrib/bdr/bdr_apply.c @@ -413,7 +413,7 @@ process_remote_update(StringInfo s) { StringInfoData s_key; char action; - HeapTuple old_key; + HeapTuple old_key = NULL; HeapTuple old_tuple; BDRTupleData new_tuple; Oid idxoid; @@ -421,7 +421,6 @@ process_remote_update(StringInfo s) Relation rel; Relation idxrel; ScanKeyData skey[INDEX_MAX_KEYS]; - bool primary_key_changed = false; rel = read_rel(s, RowExclusiveLock); @@ -436,7 +435,6 @@ process_remote_update(StringInfo s) { old_key = read_tuple(s, rel); action = pq_getmsgbyte(s); - primary_key_changed = true; } /* check for new tuple */ @@ -452,14 +450,12 @@ process_remote_update(StringInfo s) read_tuple_parts(s, rel, &new_tuple); /* - * Check which tuple we want to use for the pkey lookup. + * Generate key for lookup if the primary key didn't change. */ - if (!primary_key_changed) + if (old_key == NULL) { - /* key hasn't changed, just use columns from the new tuple */ old_key = heap_form_tuple(RelationGetDescr(rel), new_tuple.values, new_tuple.isnull); - } /* lookup index to build scankey */