Re: pgsql: Add deduplication to nbtree. - Mailing list pgsql-committers

From Peter Eisentraut
Subject Re: pgsql: Add deduplication to nbtree.
Date
Msg-id 21800dbe-a13e-22f7-d423-b81db9d249f5@2ndquadrant.com
Whole thread Raw
In response to pgsql: Add deduplication to nbtree.  (Peter Geoghegan <pg@bowt.ie>)
Responses Re: pgsql: Add deduplication to nbtree.  (Peter Geoghegan <pg@bowt.ie>)
List pgsql-committers
On 2020-02-26 22:06, Peter Geoghegan wrote:
> Add deduplication to nbtree.

AddressSanitizer has a use-after-scope complaint related to this patch.

The following change fixes it:

diff --git a/src/backend/access/nbtree/nbtinsert.c b/src/backend/access/nbtree/nbtinsert.c
index a70b64d964..8246ab4f18 100644
--- a/src/backend/access/nbtree/nbtinsert.c
+++ b/src/backend/access/nbtree/nbtinsert.c
@@ -1289,6 +1289,7 @@ _bt_insertonpg(Relation rel,
             xl_btree_metadata xlmeta;
             uint8        xlinfo;
             XLogRecPtr    recptr;
+            uint16        upostingoff;
 
             xlrec.offnum = newitemoff;
 
@@ -1354,7 +1355,7 @@ _bt_insertonpg(Relation rel,
                  * must reconstruct final itup (as well as nposting) using
                  * _bt_swap_posting().
                  */
-                uint16        upostingoff = postingoff;
+                upostingoff = postingoff;
 
                 XLogRegisterBufData(0, (char *) &upostingoff, sizeof(uint16));
                 XLogRegisterBufData(0, (char *) origitup,

Please check.

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Doc: update sections 9.14 - 9.16 for new function table layout.
Next
From: Peter Geoghegan
Date:
Subject: Re: pgsql: Add deduplication to nbtree.