From a03dc5b7d0aad1feb3ca41f8da5bfb5c70f54811 Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Sat, 5 Apr 2025 11:31:57 -0700 Subject: [PATCH] Added fields to IndexAmRoutine for Postgres 18 [skip ci] --- src/hnsw.c | 13 +++++++++++++ src/ivfflat.c | 13 +++++++++++++ 2 files changed, 26 insertions(+) diff --git a/src/hnsw.c b/src/hnsw.c index 5bfc619..ec7c988 100644 --- a/src/hnsw.c +++ b/src/hnsw.c @@ -259,6 +259,11 @@ hnswhandler(PG_FUNCTION_ARGS) amroutine->amoptsprocnum = 0; amroutine->amcanorder = false; amroutine->amcanorderbyop = true; +#if PG_VERSION_NUM >= 180000 + amroutine->amcanhash = false; + amroutine->amconsistentequality = false; + amroutine->amconsistentordering = false; +#endif amroutine->amcanbackward = false; /* can change direction mid-scan */ amroutine->amcanunique = false; amroutine->amcanmulticol = false; @@ -291,6 +296,9 @@ hnswhandler(PG_FUNCTION_ARGS) amroutine->amvacuumcleanup = hnswvacuumcleanup; amroutine->amcanreturn = NULL; amroutine->amcostestimate = hnswcostestimate; +#if PG_VERSION_NUM >= 180000 + amroutine->amgettreeheight = NULL; +#endif amroutine->amoptions = hnswoptions; amroutine->amproperty = NULL; /* TODO AMPROP_DISTANCE_ORDERABLE */ amroutine->ambuildphasename = hnswbuildphasename; @@ -311,5 +319,10 @@ hnswhandler(PG_FUNCTION_ARGS) amroutine->aminitparallelscan = NULL; amroutine->amparallelrescan = NULL; +#if PG_VERSION_NUM >= 180000 + amroutine->amtranslatestrategy = NULL; + amroutine->amtranslatecmptype = NULL; +#endif + PG_RETURN_POINTER(amroutine); } diff --git a/src/ivfflat.c b/src/ivfflat.c index 9e8370f..736d537 100644 --- a/src/ivfflat.c +++ b/src/ivfflat.c @@ -186,6 +186,11 @@ ivfflathandler(PG_FUNCTION_ARGS) amroutine->amoptsprocnum = 0; amroutine->amcanorder = false; amroutine->amcanorderbyop = true; +#if PG_VERSION_NUM >= 180000 + amroutine->amcanhash = false; + amroutine->amconsistentequality = false; + amroutine->amconsistentordering = false; +#endif amroutine->amcanbackward = false; /* can change direction mid-scan */ amroutine->amcanunique = false; amroutine->amcanmulticol = false; @@ -218,6 +223,9 @@ ivfflathandler(PG_FUNCTION_ARGS) amroutine->amvacuumcleanup = ivfflatvacuumcleanup; amroutine->amcanreturn = NULL; /* tuple not included in heapsort */ amroutine->amcostestimate = ivfflatcostestimate; +#if PG_VERSION_NUM >= 180000 + amroutine->amgettreeheight = NULL; +#endif amroutine->amoptions = ivfflatoptions; amroutine->amproperty = NULL; /* TODO AMPROP_DISTANCE_ORDERABLE */ amroutine->ambuildphasename = ivfflatbuildphasename; @@ -238,5 +246,10 @@ ivfflathandler(PG_FUNCTION_ARGS) amroutine->aminitparallelscan = NULL; amroutine->amparallelrescan = NULL; +#if PG_VERSION_NUM >= 180000 + amroutine->amtranslatestrategy = NULL; + amroutine->amtranslatecmptype = NULL; +#endif + PG_RETURN_POINTER(amroutine); }