postgresql/src/backend/access
Tom Lane a298a1e06f Fix incorrect handling of NULL index entries in indexed ROW() comparisons.
An index search using a row comparison such as ROW(a, b) > ROW('x', 'y')
would stop upon reaching a NULL entry in the "b" column, ignoring the
fact that there might be non-NULL "b" values associated with later values
of "a".  This happens because _bt_mark_scankey_required() marks the
subsidiary scankey for "b" as required, which is just wrong: it's for
a column after the one with the first inequality key (namely "a"), and
thus can't be considered a required match.

This bit of brain fade dates back to the very beginnings of our support
for indexed ROW() comparisons, in 2006.  Kind of astonishing that no one
came across it before Glen Takahashi, in bug #14010.

Back-patch to all supported versions.

Note: the given test case doesn't actually fail in unpatched 9.1, evidently
because the fix for bug #6278 (i.e., stopping at nulls in either scan
direction) is required to make it fail.  I'm sure I could devise a case
that fails in 9.1 as well, perhaps with something involving making a cursor
back up; but it doesn't seem worth the trouble.
2016-03-09 14:51:22 -05:00
..
brin Improve index AMs' opclass validation procedures. 2016-01-21 19:47:15 -05:00
common Restructure index access method API to hide most of it at the C level. 2016-01-17 19:36:59 -05:00
gin Fix whitespace 2016-01-30 15:58:20 -05:00
gist Fix lossy KNN GiST when ordering operator returns non-float8 value. 2016-02-02 15:20:33 +03:00
hash Improve ResourceOwners' behavior for large numbers of owned objects. 2016-01-26 15:20:30 -05:00
heap Department of second thoughts: remove PD_ALL_FROZEN. 2016-03-08 08:46:48 -05:00
index Improve index AMs' opclass validation procedures. 2016-01-21 19:47:15 -05:00
nbtree Fix incorrect handling of NULL index entries in indexed ROW() comparisons. 2016-03-09 14:51:22 -05:00
rmgrdesc Add new flags argument for xl_heap_visible to heap2_desc. 2016-03-08 13:28:22 -05:00
spgist Suppress compiler warning. 2016-01-21 21:14:07 -05:00
tablesample Update copyright for 2016 2016-01-02 13:33:40 -05:00
transam Add a generic command progress reporting facility. 2016-03-09 12:08:58 -05:00
Makefile TABLESAMPLE, SQL Standard and extensible 2015-05-15 14:37:10 -04:00