Re: Failing assertions in indxpath.c, placeholder.c and brin_minmax.c

Alvaro Herrera <alvherre@2ndquadrant.com>

From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Andreas Seltenreich <seltenreich@gmx.de>, pgsql-hackers@postgresql.org
Date: 2015-07-30T18:14:13Z
Lists: pgsql-hackers
Tom Lane wrote:
> Alvaro Herrera <alvherre@2ndquadrant.com> writes:
> > Tom Lane wrote:
> >> Bottom line is that somebody failed to consider the possibility of a
> >> null comparison value reaching the BRIN index lookup machinery.
> >> The code stanza that's failing supposes that only IS NULL or IS NOT NULL
> >> tests could have SK_ISNULL set, but that's just wrong.
> 
> > I think the easiest way to solve this is to consider that all indexable
> > operators are strict, and have the function return false in that case.
> > The attached patch implements that.
> 
> This looks fine to me as a localized fix.  I was wondering whether we
> could short-circuit the index lookup further upstream, but I take it from
> your comment about _bt_preprocess_keys that BRIN has no convenient place
> for that today.  (Even if it did, I'd still vote for making this change,
> for safety's sake.)

Yeah, it doesn't currently.  Hopefully we will improve that in the
future.  Particularly with regards to array keys I think there's a lot
to be done there.

I pushed this as is.  I hesitated about adding a regression test, but it
didn't seem worthwhile in the end, because if in the future we improve
scan key analysis, we will need much more extensive testing, and this
doesn't look like the type of bug that we could reintroduce in a whim.

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


Commits

  1. Fix broken assertion in BRIN code

  2. Support flattening of empty-FROM subqueries and one-row VALUES tables.

  3. Fix resource leak pointed out by Coverity.

  4. Add missing volatile qualifier.

  5. Remove dependency on wsock32.lib in favor of ws2_32

  6. Check interrupts during logical decoding more frequently.

  7. Fix contrib/pg_upgrade/test.sh for $PWD containing spaces.

  8. Secure Unix-domain sockets of "make check" temporary clusters.

  9. Adjust 9.4 release notes.

  10. Improve predtest.c's ability to reason about operator expressions.

  11. Fix pg_restore's processing of old-style BLOB COMMENTS data.

  12. Improve tuplestore's error messages for I/O failures.

  13. Remove unnecessary output expressions from unflattened subqueries.

  14. Stamp 9.4beta1.