pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@postgresql.org
Subject: pgsql: Fix incorrect handling of NULL index entries in indexed ROW() co
Date: Wed, 09 Mar 2016 19:51:32 +0000
Message-ID: <E1adk8q-0002VA-Av@gemulon.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>
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.
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/a298a1e06fb0574c898a07761f9f86c2a323919e
Modified Files
--------------
src/backend/access/nbtree/nbtutils.c | 31 ++++++++-----------------------
src/test/regress/expected/rowtypes.out | 23 +++++++++++++++++++++++
src/test/regress/sql/rowtypes.sql | 15 +++++++++++++++
3 files changed, 46 insertions(+), 23 deletions(-)
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
view thread (6+ messages) latest in thread
Message-ID: <E1adk8q-0002VA-Av@gemulon.postgresql.org> Permalink: ../E1adk8q-0002VA-Av@gemulon.postgresql.org/ Also on: postgresql.org/message-id/E1adk8q-0002VA-Av@gemulon.postgresql.org ·
reply
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Reply to all the recipients from your mail client; the link fills in the headers below: reply via email Some clients, webmail especially, drop In-Reply-To and References from a link, and the reply then starts a new thread: use the mbox below. To: pgsql-committers@postgresql.org Cc: tgl@sss.pgh.pa.us Subject: Re: pgsql: Fix incorrect handling of NULL index entries in indexed ROW() co In-Reply-To: <E1adk8q-0002VA-Av@gemulon.postgresql.org> References: <E1adk8q-0002VA-Av@gemulon.postgresql.org> * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox