From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@postgresql.org
Subject: pgsql: Prevent crash when ts_rewrite() replaces a non-top-level subtree
Date: Sun, 11 Dec 2016 18:10:14 +0000
Message-ID: <E1cG8Zi-0007C9-71@gemulon.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>
Prevent crash when ts_rewrite() replaces a non-top-level subtree with null.
When ts_rewrite()'s replacement argument is an empty tsquery, it's supposed
to simplify any operator nodes whose operand(s) become NULL; but it failed
to do that reliably, because dropvoidsubtree() only examined the top level
of the result tree. Rather than make a second recursive pass, let's just
give the responsibility to dofindsubquery() to simplify while it's doing
the main replacement pass. Per report from Andreas Seltenreich.
Artur Zakirov, with some cosmetic changes by me. Back-patch to all
supported branches.
Discussion: https://postgr.es/m/8737i01dew.fsf@credativ.de
Branch
------
REL9_2_STABLE
Details
-------
http://git.postgresql.org/pg/commitdiff/f4ccee408d7fc9d52adf9a9153130f1298e3acb1
Modified Files
--------------
src/backend/utils/adt/tsquery_rewrite.c | 58 ++++++++++++++++-----------------
src/test/regress/expected/tsearch.out | 15 +++++++++
src/test/regress/sql/tsearch.sql | 3 ++
3 files changed, 47 insertions(+), 29 deletions(-)
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
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: Prevent crash when ts_rewrite() replaces a non-top-level subtree
In-Reply-To: <E1cG8Zi-0007C9-71@gemulon.postgresql.org>
References: <E1cG8Zi-0007C9-71@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