diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2009-05-19 02:48:26 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2009-05-19 02:48:26 +0000 |
commit | 7280fab7173865f04b5cc635b0277501a18e6673 (patch) | |
tree | 1eeb6cc190c2bb0ec0196087e46ab8a599a8e3a5 /src/backend/access/gin | |
parent | 2c39ab12f32c868ef90429479937f63382fbaa7f (diff) | |
download | postgresql-7280fab7173865f04b5cc635b0277501a18e6673.tar.gz postgresql-7280fab7173865f04b5cc635b0277501a18e6673.zip |
Fix bug #4814 (wrong subscript in consistent-function call), and add some
minimal regression test coverage for matchPartialInPendingList().
Diffstat (limited to 'src/backend/access/gin')
-rw-r--r-- | src/backend/access/gin/ginget.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/backend/access/gin/ginget.c b/src/backend/access/gin/ginget.c index a0eb65e26da..d57ee8febbd 100644 --- a/src/backend/access/gin/ginget.c +++ b/src/backend/access/gin/ginget.c @@ -8,7 +8,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/gin/ginget.c,v 1.25 2009/04/05 11:32:01 teodor Exp $ + * $PostgreSQL: pgsql/src/backend/access/gin/ginget.c,v 1.26 2009/05/19 02:48:26 tgl Exp $ *------------------------------------------------------------------------- */ @@ -820,10 +820,11 @@ scanGetCandidate(IndexScanDesc scan, pendingPosition *pos) } /* - * Scan page from current tuple (off) up to the first event: - * - tuple's attribute number is not equal to entry's attrnum - * - reach of last tuple + * Scan page from current tuple (off) up till the first of: * - match is found (then returns true) + * - no later match is possible + * - tuple's attribute number is not equal to entry's attrnum + * - reach end of page */ static bool matchPartialInPendingList(GinState *ginstate, Page page, @@ -849,13 +850,13 @@ matchPartialInPendingList(GinState *ginstate, Page page, } /*---------- - * Check of partial match. + * Check partial match. * case cmp == 0 => match - * case cmp > 0 => not match and finish scan + * case cmp > 0 => not match and end scan (no later match possible) * case cmp < 0 => not match and continue scan *---------- */ - cmp = DatumGetInt32(FunctionCall4(&ginstate->comparePartialFn[attrnum], + cmp = DatumGetInt32(FunctionCall4(&ginstate->comparePartialFn[attrnum-1], value, datum[off-1], UInt16GetDatum(strategy), |