pgsql: Fix erroneous range-union logic for varlena types in contrib/btr

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix erroneous range-union logic for varlena types in contrib/btr
Date: 2013-02-07 23:23:15
Message-ID: E1U3aoF-0003cE-8h@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix erroneous range-union logic for varlena types in contrib/btree_gist.

gbt_var_bin_union() failed to do the right thing when the existing range
needed to be widened at both ends rather than just one end. This could
result in an invalid index in which keys that are present would not be
found by searches, because the searches would not think they need to
descend to the relevant leaf pages. This error affected all the varlena
datatypes supported by btree_gist (text, bytea, bit, numeric).

Per investigation of a trouble report from Tomas Vondra. (There is also
an issue in gbt_var_penalty(), but that should only result in inefficiency
not wrong answers. I'm committing this separately so that we have a git
state in which it can be tested that bad penalty results don't produce
invalid indexes.) Back-patch to all supported branches.

Branch
------
REL9_1_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/500889a9d27cd4a59995b9e28b51022a4872efb3

Modified Files
--------------
contrib/btree_gist/btree_utils_var.c | 21 +++++++++++----------
1 files changed, 11 insertions(+), 10 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2013-02-08 00:14:55 pgsql: Make contrib/btree_gist's GiST penalty function a bit saner.
Previous Message Tom Lane 2013-02-07 22:44:58 pgsql: Repair bugs in GiST page splitting code for multi-column indexes