File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments