pgsql: Fix bugs in GIN "fast scan" with partial match.

From: Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix bugs in GIN "fast scan" with partial match.
Date: 2014-04-10 20:42:13
Message-ID: E1WYLnZ-0005KA-2M@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix bugs in GIN "fast scan" with partial match.

There were a couple of bugs here. First, if the fuzzy limit was exceeded,
the loop in entryGetItem might drop out too soon if a whole block needs to
be skipped because it's < advancePast ("continue" in a while-loop checks the
loop condition too). Secondly, the loop checked when stepping to a new page
that there is at least one offset on the page < advancePast, but we cannot
rely on that on subsequent calls of entryGetItem, because advancePast might
change in between. That caused the skipping loop to read bogus items in the
TbmIterateResult's offset array.

First item and fix by Alexander Korotkov, second bug pointed out by Fabrízio
de Royes Mello, by a small variation of Alexander's test query.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/614167c6d7e98d4538c4546754b3c2dba480f71c

Modified Files
--------------
src/backend/access/gin/ginget.c | 55 +++++++++++++++++++++++----------------
1 file changed, 32 insertions(+), 23 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Bruce Momjian 2014-04-10 21:17:04 pgsql: docs: psql '--' comments are not passed to the server
Previous Message Michael Meskes 2014-04-10 18:44:27 Re: pgsql: Several fixes to array handling in ecpg.