pgsql: Fix ts_delete(tsvector, text[]) to cope with duplicate array ent

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix ts_delete(tsvector, text[]) to cope with duplicate array ent
Date: 2016-08-05 19:14:33
Message-ID: E1bVkZl-0000AC-Bz@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix ts_delete(tsvector, text[]) to cope with duplicate array entries.

Such cases either failed an Assert, or produced a corrupt tsvector in
non-Assert builds, as reported by Andreas Seltenreich. The reason is
that tsvector_delete_by_indices() just assumed that its input array had
no duplicates. Fix by explicitly de-duping.

In passing, improve some comments, and fix a number of tests for null
values to use ERRCODE_NULL_VALUE_NOT_ALLOWED not
ERRCODE_INVALID_PARAMETER_VALUE.

Discussion: <87invhoj6e(dot)fsf(at)credativ(dot)de>

Branch
------
master

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

Modified Files
--------------
src/backend/utils/adt/tsvector_op.c | 77 +++++++++++++++++++++--------------
src/test/regress/expected/tstypes.out | 6 +++
src/test/regress/sql/tstypes.sql | 1 +
3 files changed, 53 insertions(+), 31 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Andrew Dunstan 2016-08-05 19:19:59 Re: pgsql: Change InitToastSnapshot to a macro.
Previous Message Bruce Momjian 2016-08-05 18:36:22 pgsql: docs: re-add spaces before units removed