From c707c56325a5dafc378f0ab64e02a812f7cfef36 Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Tue, 20 Oct 2026 23:54:00 -0700 Subject: [PATCH] Dropped support for Postgres 13 and 14 --- .github/workflows/build.yml | 20 ++++++++------------ CHANGELOG.md | 4 ++++ META.json | 2 +- Makefile | 3 --- src/bitutils.h | 4 ++-- src/hnsw.c | 6 ------ src/hnsw.h | 21 +-------------------- src/hnswbuild.c | 24 +++--------------------- src/hnswinsert.c | 9 +-------- src/ivfbuild.c | 18 +++--------------- src/ivfflat.c | 6 ------ src/ivfflat.h | 23 ++--------------------- src/ivfinsert.c | 7 +------ src/sparsevec.c | 10 ---------- test/perl/PostgreSQL/Test/Cluster.pm | 11 ----------- test/perl/PostgreSQL/Test/Utils.pm | 5 ----- test/t/001_ivfflat_wal.pl | 1 - test/t/010_hnsw_wal.pl | 1 - 18 files changed, 26 insertions(+), 149 deletions(-) delete mode 100644 test/perl/PostgreSQL/Test/Cluster.pm delete mode 100644 test/perl/PostgreSQL/Test/Utils.pm diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0d8be515..d8c0150e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,19 +11,15 @@ jobs: - postgres: 20 os: ubuntu-26.04 - postgres: 19 - os: ubuntu-26.04 - - postgres: 18 os: ubuntu-26.04-arm - - postgres: 17 + - postgres: 18 os: ubuntu-24.04 - - postgres: 16 + - postgres: 17 os: ubuntu-24.04-arm + - postgres: 16 + os: ubuntu-22.04 - postgres: 15 - os: ubuntu-22.04 - - postgres: 14 os: ubuntu-22.04-arm - - postgres: 13 - os: ubuntu-22.04 steps: - uses: actions/checkout@v7 - uses: ankane/setup-postgres@v1 @@ -52,7 +48,7 @@ jobs: include: - postgres: 18 os: macos-26 - - postgres: 14 + - postgres: 15 os: macos-15-intel steps: - uses: actions/checkout@v7 @@ -74,7 +70,7 @@ jobs: tar xf $TAG.tar.gz mv postgres-$TAG postgres env: - TAG: ${{ matrix.postgres == 18 && 'REL_18_2' || 'REL_14_21' }} + TAG: ${{ matrix.postgres == 18 && 'REL_18_6' || 'REL_15_19' }} - run: make prove_installcheck PROVE_FLAGS="-I ./postgres/src/test/perl -I ./test/perl" env: PERL5LIB: /Users/runner/perl5/lib/perl5 @@ -91,8 +87,8 @@ jobs: include: - postgres: 17 os: windows-2025 - - postgres: 14 - os: windows-2022 + # - postgres: 14 + # os: windows-2022 steps: - uses: actions/checkout@v7 - uses: ankane/setup-postgres@v1 diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d1cbb08..9f589985 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.9.0 (unreleased) + +- Dropped support for Postgres 13 and 14 + ## 0.8.7 (2026-10-01) - Fixed buffer overflow with IVFFlat index build - [more info](https://github.com/pgvector/pgvector/issues/1036) diff --git a/META.json b/META.json index 531e895a..9389c3e3 100644 --- a/META.json +++ b/META.json @@ -12,7 +12,7 @@ "prereqs": { "runtime": { "requires": { - "PostgreSQL": "13.0.0" + "PostgreSQL": "15.0.0" } } }, diff --git a/Makefile b/Makefile index ee473016..207a19b2 100644 --- a/Makefile +++ b/Makefile @@ -57,9 +57,6 @@ ifeq ($(PROVE),) PROVE = prove endif -# for Postgres < 15 -PROVE_FLAGS += -I ./test/perl - prove_installcheck: rm -rf $(CURDIR)/tmp_check cd $(srcdir) && TESTDIR='$(CURDIR)' PATH="$(bindir):$$PATH" PGPORT='6$(DEF_PGPORT)' PG_REGRESS='$(top_builddir)/src/test/regress/pg_regress' $(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS) $(if $(PROVE_TESTS),$(PROVE_TESTS),test/t/*.pl) diff --git a/src/bitutils.h b/src/bitutils.h index b4d85bb1..1a68cfa7 100644 --- a/src/bitutils.h +++ b/src/bitutils.h @@ -4,8 +4,8 @@ #include "postgres.h" /* Check version in first header */ -#if PG_VERSION_NUM < 130000 -#error "Requires PostgreSQL 13+" +#if PG_VERSION_NUM < 150000 +#error "Requires PostgreSQL 15+" #endif extern uint64 (*BitHammingDistance) (uint32 bytes, unsigned char *ax, unsigned char *bx, uint64 distance); diff --git a/src/hnsw.c b/src/hnsw.c index 70f60409..55c7519b 100644 --- a/src/hnsw.c +++ b/src/hnsw.c @@ -21,10 +21,6 @@ #include "utils/spccache.h" #include "vector.h" -#if PG_VERSION_NUM < 150000 -#define MarkGUCPrefixReserved(x) EmitWarningsOnPlaceholders(x) -#endif - static const struct config_enum_entry hnsw_iterative_scan_options[] = { {"off", HNSW_ITERATIVE_SCAN_OFF, false}, {"relaxed_order", HNSW_ITERATIVE_SCAN_RELAXED, false}, @@ -376,9 +372,7 @@ hnswhandler(PG_FUNCTION_ARGS) amroutine->amproperty = NULL; /* TODO AMPROP_DISTANCE_ORDERABLE */ amroutine->ambuildphasename = hnswbuildphasename; amroutine->amvalidate = hnswvalidate; -#if PG_VERSION_NUM >= 140000 amroutine->amadjustmembers = NULL; -#endif amroutine->ambeginscan = hnswbeginscan; amroutine->amrescan = hnswrescan; amroutine->amgettuple = hnswgettuple; diff --git a/src/hnsw.h b/src/hnsw.h index 79007111..31b9a114 100644 --- a/src/hnsw.h +++ b/src/hnsw.h @@ -101,18 +101,8 @@ typedef Pointer Item; #define HnswBench(name, code) (code) #endif -#if PG_VERSION_NUM >= 150000 #define RandomDouble() pg_prng_double(&pg_global_prng_state) #define SeedRandom(seed) pg_prng_seed(&pg_global_prng_state, seed) -#else -#define RandomDouble() (((double) random()) / MAX_RANDOM_VALUE) -#define SeedRandom(seed) srandom(seed) -#endif - -#if PG_VERSION_NUM < 140006 -#define palloc_object(type) ((type *) palloc(sizeof(type))) -#define palloc0_object(type) ((type *) palloc0(sizeof(type))) -#endif #if PG_VERSION_NUM >= 190000 #define palloc_array_checked(type, count) ((type *) palloc_array(type, count)) @@ -137,10 +127,6 @@ typedef Pointer Item; #define HnswGetValue(base, element) PointerGetDatum(HnswPtrAccess(base, (element)->value)) -#if PG_VERSION_NUM < 140005 -#define relptr_offset(rp) ((rp).relptr_off - 1) -#endif - /* Pointer macros */ #define HnswPtrAccess(base, hp) ((base) == NULL ? (hp).ptr : relptr_access(base, (hp).relptr)) #define HnswPtrStore(base, hp, value) ((base) == NULL ? (void) ((hp).ptr = (value)) : (void) relptr_store(base, (hp).relptr, value)) @@ -492,12 +478,7 @@ PGDLLEXPORT void HnswParallelBuildMain(dsm_segment *seg, shm_toc *toc); /* Index access methods */ IndexBuildResult *hnswbuild(Relation heap, Relation index, IndexInfo *indexInfo); void hnswbuildempty(Relation index); -bool hnswinsert(Relation index, Datum *values, bool *isnull, ItemPointer heap_tid, Relation heap, IndexUniqueCheck checkUnique -#if PG_VERSION_NUM >= 140000 - ,bool indexUnchanged -#endif - ,IndexInfo *indexInfo -); +bool hnswinsert(Relation index, Datum *values, bool *isnull, ItemPointer heap_tid, Relation heap, IndexUniqueCheck checkUnique, bool indexUnchanged, IndexInfo *indexInfo); IndexBulkDeleteResult *hnswbulkdelete(IndexVacuumInfo *info, IndexBulkDeleteResult *stats, IndexBulkDeleteCallback callback, void *callback_state); IndexBulkDeleteResult *hnswvacuumcleanup(IndexVacuumInfo *info, IndexBulkDeleteResult *stats); IndexScanDesc hnswbeginscan(Relation index, int nkeys, int norderbys); diff --git a/src/hnswbuild.c b/src/hnswbuild.c index bb2e9dc6..cd323c52 100644 --- a/src/hnswbuild.c +++ b/src/hnswbuild.c @@ -56,26 +56,18 @@ #include "storage/bufmgr.h" #include "storage/condition_variable.h" #include "tcop/tcopprot.h" +#include "utils/backend_progress.h" +#include "utils/backend_status.h" #include "utils/datum.h" #include "utils/memutils.h" #include "utils/rel.h" #include "utils/snapmgr.h" +#include "utils/wait_event.h" #if PG_VERSION_NUM >= 160000 #include "varatt.h" #endif -#if PG_VERSION_NUM >= 140000 -#include "utils/backend_progress.h" -#else -#include "pgstat.h" -#endif - -#if PG_VERSION_NUM >= 140000 -#include "utils/backend_status.h" -#include "utils/wait_event.h" -#endif - #define PARALLEL_KEY_HNSW_SHARED UINT64CONST(0xA000000000000001) #define PARALLEL_KEY_HNSW_AREA UINT64CONST(0xA000000000000002) #define PARALLEL_KEY_QUERY_TEXT UINT64CONST(0xA000000000000003) @@ -731,9 +723,7 @@ InitBuildState(HnswBuildState * buildstate, Relation heap, Relation index, Index buildstate->graphCtx = GenerationContextCreate(CurrentMemoryContext, "Hnsw build graph context", -#if PG_VERSION_NUM >= 150000 1024 * 1024, 1024 * 1024, -#endif 1024 * 1024); buildstate->tmpCtx = AllocSetContextCreate(CurrentMemoryContext, "Hnsw build temporary context", @@ -1012,14 +1002,6 @@ HnswBeginParallel(HnswBuildState * buildstate, bool isconcurrent, int request) hnswarea = (char *) shm_toc_allocate(pcxt->toc, esthnswarea); InitGraph(&hnswshared->graphData, hnswarea, esthnswarea); - /* - * Avoid base address for relptr for Postgres < 14.5 - * https://github.com/postgres/postgres/commit/7201cd18627afc64850537806da7f22150d1a83b - */ -#if PG_VERSION_NUM < 140005 - hnswshared->graphData.memoryUsed = add_size(hnswshared->graphData.memoryUsed, MAXALIGN(1)); -#endif - shm_toc_insert(pcxt->toc, PARALLEL_KEY_HNSW_SHARED, hnswshared); shm_toc_insert(pcxt->toc, PARALLEL_KEY_HNSW_AREA, hnswarea); diff --git a/src/hnswinsert.c b/src/hnswinsert.c index c7afa7ee..4e6affbd 100644 --- a/src/hnswinsert.c +++ b/src/hnswinsert.c @@ -550,9 +550,7 @@ HnswUpdateNeighborsOnDisk(Relation index, HnswSupport * support, HnswElement e, /* Use separate memory context to improve performance for larger vectors */ MemoryContext updateCtx = GenerationContextCreate(CurrentMemoryContext, "Hnsw insert update context", -#if PG_VERSION_NUM >= 150000 128 * 1024, 128 * 1024, -#endif 128 * 1024); for (int lc = e->level; lc >= 0; lc--) @@ -770,12 +768,7 @@ HnswInsertTuple(Relation index, Datum *values, bool *isnull, ItemPointer heaptid */ bool hnswinsert(Relation index, Datum *values, bool *isnull, ItemPointer heap_tid, - Relation heap, IndexUniqueCheck checkUnique -#if PG_VERSION_NUM >= 140000 - ,bool indexUnchanged -#endif - ,IndexInfo *indexInfo -) + Relation heap, IndexUniqueCheck checkUnique, bool indexUnchanged, IndexInfo *indexInfo) { MemoryContext oldCtx; MemoryContext insertCtx; diff --git a/src/ivfbuild.c b/src/ivfbuild.c index ce262a22..ec12dc2e 100644 --- a/src/ivfbuild.c +++ b/src/ivfbuild.c @@ -24,27 +24,19 @@ #include "storage/bufmgr.h" #include "storage/condition_variable.h" #include "tcop/tcopprot.h" +#include "utils/backend_progress.h" +#include "utils/backend_status.h" #include "utils/memutils.h" #include "utils/rel.h" #include "utils/sampling.h" #include "utils/snapmgr.h" #include "utils/tuplesort.h" +#include "utils/wait_event.h" #if PG_VERSION_NUM >= 160000 #include "varatt.h" #endif -#if PG_VERSION_NUM >= 140000 -#include "utils/backend_progress.h" -#else -#include "pgstat.h" -#endif - -#if PG_VERSION_NUM >= 140000 -#include "utils/backend_status.h" -#include "utils/wait_event.h" -#endif - #define PARALLEL_KEY_IVFFLAT_SHARED UINT64CONST(0xA000000000000001) #define PARALLEL_KEY_TUPLESORT UINT64CONST(0xA000000000000002) #define PARALLEL_KEY_IVFFLAT_CENTERS UINT64CONST(0xA000000000000003) @@ -87,11 +79,7 @@ AddSample(Datum *values, IvfflatBuildState * buildstate) if (buildstate->rowstoskip <= 0) { -#if PG_VERSION_NUM >= 150000 int k = (int) (targsamples * sampler_random_fract(&buildstate->rstate.randstate)); -#else - int k = (int) (targsamples * sampler_random_fract(buildstate->rstate.randstate)); -#endif Assert(k >= 0 && k < targsamples); VectorArraySet(samples, k, DatumGetPointer(value)); diff --git a/src/ivfflat.c b/src/ivfflat.c index 8489d936..e5285a08 100644 --- a/src/ivfflat.c +++ b/src/ivfflat.c @@ -17,10 +17,6 @@ #include "utils/spccache.h" #include "vector.h" -#if PG_VERSION_NUM < 150000 -#define MarkGUCPrefixReserved(x) EmitWarningsOnPlaceholders(x) -#endif - int ivfflat_probes; int ivfflat_iterative_scan; int ivfflat_max_probes; @@ -293,9 +289,7 @@ ivfflathandler(PG_FUNCTION_ARGS) amroutine->amproperty = NULL; /* TODO AMPROP_DISTANCE_ORDERABLE */ amroutine->ambuildphasename = ivfflatbuildphasename; amroutine->amvalidate = ivfflatvalidate; -#if PG_VERSION_NUM >= 140000 amroutine->amadjustmembers = NULL; -#endif amroutine->ambeginscan = ivfflatbeginscan; amroutine->amrescan = ivfflatrescan; amroutine->amgettuple = ivfflatgettuple; diff --git a/src/ivfflat.h b/src/ivfflat.h index febc56d4..462017b5 100644 --- a/src/ivfflat.h +++ b/src/ivfflat.h @@ -6,6 +6,7 @@ #include "access/genam.h" #include "access/generic_xlog.h" #include "access/parallel.h" +#include "common/pg_prng.h" #include "lib/pairingheap.h" #include "nodes/execnodes.h" #include "port.h" /* for random() */ @@ -18,10 +19,6 @@ #include "varatt.h" #endif -#if PG_VERSION_NUM >= 150000 -#include "common/pg_prng.h" -#endif - #if PG_VERSION_NUM < 190000 #include "storage/shmem.h" /* for add_size()/mul_size() in some versions */ #endif @@ -83,20 +80,9 @@ typedef Pointer Item; #define IvfflatBench(name, code) (code) #endif -#if PG_VERSION_NUM >= 150000 #define RandomDouble() pg_prng_double(&pg_global_prng_state) #define RandomInt() pg_prng_uint32(&pg_global_prng_state) #define SeedRandom(seed) pg_prng_seed(&pg_global_prng_state, seed) -#else -#define RandomDouble() (((double) random()) / MAX_RANDOM_VALUE) -#define RandomInt() random() -#define SeedRandom(seed) srandom(seed) -#endif - -#if PG_VERSION_NUM < 140006 -#define palloc_object(type) ((type *) palloc(sizeof(type))) -#define palloc0_object(type) ((type *) palloc0(sizeof(type))) -#endif #if PG_VERSION_NUM >= 190000 #define palloc_array_checked(type, count) ((type *) palloc_array(type, count)) @@ -367,12 +353,7 @@ PGDLLEXPORT void IvfflatParallelBuildMain(dsm_segment *seg, shm_toc *toc); /* Index access methods */ IndexBuildResult *ivfflatbuild(Relation heap, Relation index, IndexInfo *indexInfo); void ivfflatbuildempty(Relation index); -bool ivfflatinsert(Relation index, Datum *values, bool *isnull, ItemPointer heap_tid, Relation heap, IndexUniqueCheck checkUnique -#if PG_VERSION_NUM >= 140000 - ,bool indexUnchanged -#endif - ,IndexInfo *indexInfo -); +bool ivfflatinsert(Relation index, Datum *values, bool *isnull, ItemPointer heap_tid, Relation heap, IndexUniqueCheck checkUnique, bool indexUnchanged, IndexInfo *indexInfo); IndexBulkDeleteResult *ivfflatbulkdelete(IndexVacuumInfo *info, IndexBulkDeleteResult *stats, IndexBulkDeleteCallback callback, void *callback_state); IndexBulkDeleteResult *ivfflatvacuumcleanup(IndexVacuumInfo *info, IndexBulkDeleteResult *stats); IndexScanDesc ivfflatbeginscan(Relation index, int nkeys, int norderbys); diff --git a/src/ivfinsert.c b/src/ivfinsert.c index 5efb337a..ba146d84 100644 --- a/src/ivfinsert.c +++ b/src/ivfinsert.c @@ -188,12 +188,7 @@ InsertTuple(Relation index, Datum *values, bool *isnull, ItemPointer heap_tid) */ bool ivfflatinsert(Relation index, Datum *values, bool *isnull, ItemPointer heap_tid, - Relation heap, IndexUniqueCheck checkUnique -#if PG_VERSION_NUM >= 140000 - ,bool indexUnchanged -#endif - ,IndexInfo *indexInfo -) + Relation heap, IndexUniqueCheck checkUnique, bool indexUnchanged, IndexInfo *indexInfo) { MemoryContext oldCtx; MemoryContext insertCtx; diff --git a/src/sparsevec.c b/src/sparsevec.c index 0ebd91aa..031c0c1e 100644 --- a/src/sparsevec.c +++ b/src/sparsevec.c @@ -407,17 +407,7 @@ sparsevec_in(PG_FUNCTION_ARGS) #define AppendChar(ptr, c) (*(ptr)++ = (c)) #define AppendFloat(ptr, f) ((ptr) += float_to_shortest_decimal_bufn((f), (ptr))) - -#if PG_VERSION_NUM >= 140000 #define AppendInt(ptr, i) ((ptr) += pg_ltoa((i), (ptr))) -#else -#define AppendInt(ptr, i) \ - do { \ - pg_ltoa(i, ptr); \ - while (*ptr != '\0') \ - ptr++; \ - } while (0) -#endif /* * Convert internal representation to textual representation diff --git a/test/perl/PostgreSQL/Test/Cluster.pm b/test/perl/PostgreSQL/Test/Cluster.pm deleted file mode 100644 index 0ceff971..00000000 --- a/test/perl/PostgreSQL/Test/Cluster.pm +++ /dev/null @@ -1,11 +0,0 @@ -package PostgreSQL::Test::Cluster; - -use PostgresNode; - -sub new -{ - my ($class, $name) = @_; - return get_new_node($name); -} - -1; diff --git a/test/perl/PostgreSQL/Test/Utils.pm b/test/perl/PostgreSQL/Test/Utils.pm deleted file mode 100644 index e8507155..00000000 --- a/test/perl/PostgreSQL/Test/Utils.pm +++ /dev/null @@ -1,5 +0,0 @@ -package PostgreSQL::Test::Utils; - -use TestLib; - -1; diff --git a/test/t/001_ivfflat_wal.pl b/test/t/001_ivfflat_wal.pl index c5dc57c9..ebad2d6f 100644 --- a/test/t/001_ivfflat_wal.pl +++ b/test/t/001_ivfflat_wal.pl @@ -53,7 +53,6 @@ $node_primary = PostgreSQL::Test::Cluster->new('primary'); $node_primary->init(allows_streaming => 1); if ($dim > 32) { - # TODO use wal_keep_segments for Postgres < 13 $node_primary->append_conf('postgresql.conf', qq(wal_keep_size = 1GB)); } if ($dim > 1500) diff --git a/test/t/010_hnsw_wal.pl b/test/t/010_hnsw_wal.pl index 234fafac..76bd52f6 100644 --- a/test/t/010_hnsw_wal.pl +++ b/test/t/010_hnsw_wal.pl @@ -53,7 +53,6 @@ $node_primary = PostgreSQL::Test::Cluster->new('primary'); $node_primary->init(allows_streaming => 1); if ($dim > 32) { - # TODO use wal_keep_segments for Postgres < 13 $node_primary->append_conf('postgresql.conf', qq(wal_keep_size = 1GB)); } if ($dim > 1500)