From 7c65fd13c104a26f0f5d38ed1187d42ba3b94cc5 Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Tue, 10 Jan 2023 02:35:08 -0800 Subject: [PATCH] Detoast once for all calls --- src/ivfinsert.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ivfinsert.c b/src/ivfinsert.c index 7394bc0..09a8326 100644 --- a/src/ivfinsert.c +++ b/src/ivfinsert.c @@ -168,10 +168,12 @@ ivfflatinsert(Relation index, Datum *values, bool *isnull, ItemPointer heap_tid, Datum value; FmgrInfo *normprocinfo; + /* Skip nulls */ if (isnull[0]) return false; - value = values[0]; + /* Detoast once for all calls */ + value = PointerGetDatum(PG_DETOAST_DATUM(values[0])); /* Normalize if needed */ normprocinfo = IvfflatOptionalProcInfo(index, IVFFLAT_NORM_PROC);