From b1237c7c4e27522f9c36cd74b1ab1522efbf3594 Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Tue, 10 Jan 2023 01:20:25 -0800 Subject: [PATCH] Added separate dimensions limit for ivfflat indexes --- src/ivfbuild.c | 3 +++ src/ivfflat.h | 2 ++ 2 files changed, 5 insertions(+) diff --git a/src/ivfbuild.c b/src/ivfbuild.c index 0dbfd61..40f35c2 100644 --- a/src/ivfbuild.c +++ b/src/ivfbuild.c @@ -338,6 +338,9 @@ InitBuildState(IvfflatBuildState * buildstate, Relation heap, Relation index, In if (buildstate->dimensions < 0) elog(ERROR, "column does not have dimensions"); + if (buildstate->dimensions > IVFFLAT_MAX_DIM) + elog(ERROR, "ivfflat index cannot have more than %d dimensions", IVFFLAT_MAX_DIM); + buildstate->reltuples = 0; buildstate->indtuples = 0; diff --git a/src/ivfflat.h b/src/ivfflat.h index 191e6f6..c798088 100644 --- a/src/ivfflat.h +++ b/src/ivfflat.h @@ -23,6 +23,8 @@ #include "portability/instr_time.h" #endif +#define IVFFLAT_MAX_DIM VECTOR_MAX_DIM + /* Support functions */ #define IVFFLAT_DISTANCE_PROC 1 #define IVFFLAT_NORM_PROC 2