pgvector.git / summary / log / commit / refs
commit b1237c7c4e27522f9c36cd74b1ab1522efbf3594
Author: Andrew Kane <andrew@ankane.org>
Date: Tue Jan 10 09:20:25 2023 +0000
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 0dbfd614..40f35c25 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 191e6f6a..c7980888 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
[parent: 66108cb406c5]