]> granicus.if.org Git - postgresql/commit
Fix erroneous range-union logic for varlena types in contrib/btree_gist.
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 7 Feb 2013 23:22:38 +0000 (18:22 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 7 Feb 2013 23:22:38 +0000 (18:22 -0500)
commit45b315efd83553871e8e966c1c03441b5601a306
tree852541c68d0da778753b44e9604af78b2d8117ca
parent932ab7462be18fb905dc2ebd57c729838175947f
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.
contrib/btree_gist/btree_utils_var.c