fix counting in gin_stat for versions >= 9.4
authorTeodor Sigaev <teodor@sigaev.ru>
Fri, 13 Nov 2015 16:43:32 +0000 (19:43 +0300)
committerTeodor Sigaev <teodor@sigaev.ru>
Fri, 13 Nov 2015 16:43:32 +0000 (19:43 +0300)
gevel.c

diff --git a/gevel.c b/gevel.c
index f0e3738..59bec84 100644 (file)
--- 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);