From d72ee71f2367cf21b0434c33ff05c0d4c89802d1 Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Wed, 10 Dec 2025 14:59:29 -0800 Subject: [PATCH] Fixed compilation errors with Postgres 19 --- src/hnsw.h | 4 ++++ src/hnswbuild.c | 2 +- src/hnswinsert.c | 2 +- src/hnswutils.c | 6 +++--- src/ivfflat.h | 4 ++++ 5 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/hnsw.h b/src/hnsw.h index 5102bfb..a192a02 100644 --- a/src/hnsw.h +++ b/src/hnsw.h @@ -12,6 +12,10 @@ #include "utils/sampling.h" #include "vector.h" +#if PG_VERSION_NUM >= 190000 +typedef Pointer Item; +#endif + #define HNSW_MAX_DIM 2000 #define HNSW_MAX_NNZ 1000 diff --git a/src/hnswbuild.c b/src/hnswbuild.c index 03f0ef4..939f48f 100644 --- a/src/hnswbuild.c +++ b/src/hnswbuild.c @@ -549,7 +549,7 @@ InsertTuple(Relation index, Datum *values, bool *isnull, ItemPointer heaptid, Hn /* Copy the datum */ memcpy(valuePtr, DatumGetPointer(value), valueSize); - HnswPtrStore(base, element->value, valuePtr); + HnswPtrStore(base, element->value, (char *) valuePtr); /* Create a lock for the element */ LWLockInitialize(&element->lock, hnsw_lock_tranche_id); diff --git a/src/hnswinsert.c b/src/hnswinsert.c index a4d2885..ddcead0 100644 --- a/src/hnswinsert.c +++ b/src/hnswinsert.c @@ -712,7 +712,7 @@ HnswInsertTupleOnDisk(Relation index, HnswSupport * support, Datum value, ItemPo /* Create an element */ element = HnswInitElement(base, heaptid, m, HnswGetMl(m), HnswGetMaxLevel(m), NULL); - HnswPtrStore(base, element->value, DatumGetPointer(value)); + HnswPtrStore(base, element->value, (char *) DatumGetPointer(value)); /* Prevent concurrent inserts when likely updating entry point */ if (entryPoint == NULL || element->level > entryPoint->level) diff --git a/src/hnswutils.c b/src/hnswutils.c index 8e2a42c..13ecb9d 100644 --- a/src/hnswutils.c +++ b/src/hnswutils.c @@ -260,7 +260,7 @@ HnswInitElement(char *base, ItemPointer heaptid, int m, double ml, int maxLevel, HnswInitNeighbors(base, element, m, allocator); - HnswPtrStore(base, element->value, (Pointer) NULL); + HnswPtrStore(base, element->value, (char *) NULL); return element; } @@ -286,7 +286,7 @@ HnswInitElementFromBlock(BlockNumber blkno, OffsetNumber offno) element->blkno = blkno; element->offno = offno; HnswPtrStore(base, element->neighbors, (HnswNeighborArrayPtr *) NULL); - HnswPtrStore(base, element->value, (Pointer) NULL); + HnswPtrStore(base, element->value, (char *) NULL); return element; } @@ -512,7 +512,7 @@ HnswLoadElementFromTuple(HnswElement element, HnswElementTuple etup, bool loadHe char *base = NULL; Datum value = datumCopy(PointerGetDatum(&etup->data), false, -1); - HnswPtrStore(base, element->value, DatumGetPointer(value)); + HnswPtrStore(base, element->value, (char *) DatumGetPointer(value)); } } diff --git a/src/ivfflat.h b/src/ivfflat.h index c4e64e1..0d9601e 100644 --- a/src/ivfflat.h +++ b/src/ivfflat.h @@ -25,6 +25,10 @@ #include "portability/instr_time.h" #endif +#if PG_VERSION_NUM >= 190000 +typedef Pointer Item; +#endif + #define IVFFLAT_MAX_DIM 2000 /* Support functions */