From 893bc0d7a7fd49acf10f29af990d7c593b406ca6 Mon Sep 17 00:00:00 2001 From: Teodor Sigaev Date: Fri, 13 Nov 2015 19:43:32 +0300 Subject: [PATCH] fix counting in gin_stat for versions >= 9.4 --- gevel.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gevel.c b/gevel.c index f0e3738..59bec84 100644 --- a/gevel.c +++ b/gevel.c @@ -739,19 +739,20 @@ processTuple( FuncCallContext *funcctx, GinStatState *st, IndexTuple itup ) { list = GinDataLeafPageGetItems(page, &nlist, minItem); pfree(list); predictNumber = stack->predictNumber; + st->dvalues[1] = Int32GetDatum( predictNumber * nlist ); #elif PG_VERSION_NUM >= 90100 gdi = ginPrepareScanPostingTree(st->index, rootblkno, TRUE); entrybuffer = ginScanBeginPostingTree(gdi); page = BufferGetPage(entrybuffer); predictNumber = gdi->stack->predictNumber; + st->dvalues[1] = Int32GetDatum( predictNumber * GinPageGetOpaque(page)->maxoff ); #else gdi = prepareScanPostingTree(st->index, rootblkno, TRUE); entrybuffer = scanBeginPostingTree(gdi); page = BufferGetPage(entrybuffer); predictNumber = gdi->stack->predictNumber; -#endif - st->dvalues[1] = Int32GetDatum( predictNumber * GinPageGetOpaque(page)->maxoff ); +#endif #if PG_VERSION_NUM < 90400 LockBuffer(entrybuffer, GIN_UNLOCK); -- 2.46.1