pgsql: Fix broken assertion in BRIN code

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix broken assertion in BRIN code
Date: 2015-07-30 18:08:28
Message-ID: E1ZKsFo-0008Ge-Ey@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix broken assertion in BRIN code

The code was assuming that any NULL value in scan keys was due to IS
NULL or IS NOT NULL, but it turns out to be possible to get them with
other operators too, if they are used in contrived-enough ways. Easiest
way out of the problem seems to check explicitely for the IS NOT NULL
flag, instead of assuming it must be set if the IS NULL flag is not set,
when a null scan key is found; if neither flag is set, follow the lead
of other index AMs and assume that all indexable operators must be
strict, and thus the query is never satisfiable.

Also, add a comment to try and lure some future hacker into improving
analysis of scan keys in brin.

Per report from Andreas Seltenreich; diagnosis by Tom Lane.
Backpatch to 9.5.

Discussion: http://www.postgresql.org/message-id/20646.1437919632@sss.pgh.pa.us

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/c81276241b61d8759e024ed803e8f3f251d8e7c9

Modified Files
--------------
src/backend/access/brin/brin.c | 8 ++++++++
src/backend/access/brin/brin_inclusion.c | 10 ++++++++--
src/backend/access/brin/brin_minmax.c | 10 ++++++++--
3 files changed, 24 insertions(+), 4 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Alvaro Herrera 2015-07-30 18:21:41 pgsql: Fix volatility marking of commit timestamp functions
Previous Message Joe Conway 2015-07-30 17:17:22 pgsql: Improve CREATE FUNCTION doc WRT to LEAKPROOF RLS interaction.