From 310809d0e576fa6af283cacbf951631c000d57a4 Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Sun, 13 Feb 2022 03:03:17 -0800 Subject: [PATCH] Fixed warnings --- src/ivfscan.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ivfscan.c b/src/ivfscan.c index 09b2baa..b557fea 100644 --- a/src/ivfscan.c +++ b/src/ivfscan.c @@ -1,5 +1,7 @@ #include "postgres.h" +#include + #include "access/relscan.h" #include "ivfflat.h" #include "miscadmin.h" @@ -46,7 +48,7 @@ GetScanLists(IndexScanDesc scan, Datum value) IvfflatScanOpaque so = (IvfflatScanOpaque) scan->opaque; double distance; IvfflatScanList *scanlist; - double maxDistance; + double maxDistance = DBL_MAX; /* Search all list pages */ while (BlockNumberIsValid(nextblkno)) @@ -194,6 +196,9 @@ ivfflatbeginscan(Relation index, int nkeys, int norderbys) scan = RelationGetIndexScan(index, nkeys, norderbys); lists = IvfflatGetLists(scan->indexRelation); + if (probes > lists) + probes = lists; + so = (IvfflatScanOpaque) palloc(offsetof(IvfflatScanOpaqueData, lists) + probes * sizeof(IvfflatScanList)); so->buf = InvalidBuffer; so->first = true;