Skip to content

Commit a219c4a

Browse files
author
Nikita Glukhov
committed
Fix PG_FREE_IF_COPY() macro for expanded objects
1 parent 8cfcd59 commit a219c4a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/include/fmgr.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,9 @@ extern struct varlena *pg_detoast_datum_packed(struct varlena *datum);
248248
#define PG_DETOAST_DATUM_PACKED(datum) \
249249
pg_detoast_datum_packed((struct varlena *) DatumGetPointer(datum))
250250

251+
struct ExpandedObjectHeader;
252+
extern struct ExpandedObjectHeader *DatumGetEOHP(Datum d);
253+
251254
/*
252255
* Support for cleaning up detoasted copies of inputs. This must only
253256
* be used for pass-by-ref datatypes, and normally would only be used
@@ -259,7 +262,9 @@ extern struct varlena *pg_detoast_datum_packed(struct varlena *datum);
259262
*/
260263
#define PG_FREE_IF_COPY(ptr,n) \
261264
do { \
262-
if ((Pointer) (ptr) != PG_GETARG_POINTER(n)) \
265+
if ((Pointer) (ptr) != PG_GETARG_POINTER(n) && \
266+
(!VARATT_IS_EXTERNAL_EXPANDED(PG_GETARG_POINTER(n)) || \
267+
(Pointer) DatumGetEOHP(PG_GETARG_DATUM(n)) != (Pointer)(ptr))) \
263268
pfree(ptr); \
264269
} while (0)
265270

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy