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