From de410a2915c542138487a4084bfc0fdf71039aae Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Fri, 29 Mar 2024 10:57:16 -0700 Subject: [PATCH] Use variable for max dimemsions [skip ci] --- src/hnswbuild.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/hnswbuild.c b/src/hnswbuild.c index 036b5de..7a89a61 100644 --- a/src/hnswbuild.c +++ b/src/hnswbuild.c @@ -671,6 +671,8 @@ HnswSharedMemoryAlloc(Size size, void *state) static void InitBuildState(HnswBuildState * buildstate, Relation heap, Relation index, IndexInfo *indexInfo, ForkNumber forkNum) { + int maxDimensions = HNSW_MAX_DIM; + buildstate->heap = heap; buildstate->index = index; buildstate->indexInfo = indexInfo; @@ -684,8 +686,8 @@ InitBuildState(HnswBuildState * buildstate, Relation heap, Relation index, Index if (buildstate->dimensions < 0) elog(ERROR, "column does not have dimensions"); - if (buildstate->dimensions > HNSW_MAX_DIM) - elog(ERROR, "column cannot have more than %d dimensions for hnsw index", HNSW_MAX_DIM); + if (buildstate->dimensions > maxDimensions) + elog(ERROR, "column cannot have more than %d dimensions for hnsw index", maxDimensions); if (buildstate->efConstruction < 2 * buildstate->m) elog(ERROR, "ef_construction must be greater than or equal to 2 * m");