From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-committers(at)postgresql(dot)org |
Subject: | pgsql: Fix bogus tree-flattening logic in QTNTernary(). |
Date: | 2016-10-30 19:25:04 |
Message-ID: | E1c0vj6-0005NC-FM@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-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_3_STABLE
Details
-------
http://git.postgresql.org/pg/commitdiff/77a22f898e6633c9f15e0c3edfa6f6296ba6f17b
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(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2016-10-30 21:36:08 | pgsql: Fix nasty performance problem in tsquery_rewrite(). |
Previous Message | Tom Lane | 2016-10-30 16:27:58 | pgsql: Improve speed of aggregates that use array_append as transition |