pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@postgresql.org
Subject: pgsql: Fix bogus tree-flattening logic in QTNTernary().
Date: Sun, 30 Oct 2016 19:25:04 +0000
Message-ID: <E1c0vj6-0005ND-FP@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

Fix bogus tree-flattening logic in QTNTernary().

QTNTernary() contains logic to flatten, eg, '(a & b) & c' into 'a & b & c',
which is all well and good, but it tries to do that to NOT nodes as well,
so that '!!a' gets changed to '!a'.  Explicitly restrict the conversion to
be done only on AND and OR nodes, and add a test case illustrating the bug.

In passing, provide some comments for the sadly naked functions in
tsquery_util.c, and simplify some baroque logic in QTNFree(), which
I think may have been leaking some items it intended to free.

Noted while investigating a complaint from Andreas Seltenreich.
Back-patch to all supported versions.

Branch
------
REL9_2_STABLE

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

Modified Files
--------------
src/backend/utils/adt/tsquery_util.c  | 81 ++++++++++++++++++++++++++---------
src/test/regress/expected/tsearch.out |  7 +++
src/test/regress/sql/tsearch.sql      |  2 +
3 files changed, 69 insertions(+), 21 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)

Message-ID: <E1c0vj6-0005ND-FP@gemulon.postgresql.org>
Permalink:  ../E1c0vj6-0005ND-FP@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1c0vj6-0005ND-FP@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 bogus tree-flattening logic in QTNTernary().
  In-Reply-To: <E1c0vj6-0005ND-FP@gemulon.postgresql.org>
  References: <E1c0vj6-0005ND-FP@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