From: | Michael Paquier <michael(at)paquier(dot)xyz> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Fix various issues with ALTER TEXT SEARCH CONFIGURATION |
Date: | 2024-01-31 04:17:18 |
Message-ID: | E1rV22I-003wO3-VE@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Fix various issues with ALTER TEXT SEARCH CONFIGURATION
This commit addresses a set of issues when changing token type mappings
in a text search configuration when using duplicated token names:
- ADD MAPPING would fail on insertion because of a constraint failure
after inserting the same mapping.
- ALTER MAPPING with an "overridden" configuration failed with "tuple
already updated by self" when the token mappings are removed.
- DROP MAPPING failed with "tuple already updated by self", like
previously, but in a different code path.
The code is refactored so the token names (with their numbers) are
handled as a List with unique members rather than an array with numbers,
ensuring that no duplicates mess up with the catalog inserts, updates
and deletes. The list is generated by getTokenTypes(), with the same
error handling as previously while duplicated tokens are discarded from
the list used to work on the catalogs.
Regression tests are expanded to cover much more ground for the cases
fixed by this commit, as there was no coverage for the code touched in
this commit. A bit more is done regarding the fact that a token name
not supported by a configuration's parser should result in an error even
if IF EXISTS is used in a DROP MAPPING clause. This is implied in the
code but there was no coverage for that, and it was very easy to miss.
These issues exist since at least their introduction in core with
140d4ebcb46e, so backpatch all the way down.
Reported-by: Alexander Lakhin
Author: Tender Wang, Michael Paquier
Discussion: https://postgr.es/m/18310-1eb233c5908189c8@postgresql.org
Backpatch-through: 12
Branch
------
REL_15_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/41fa4b31c12f4affc5d0ed1e257dacaf2bbe0731
Modified Files
--------------
src/backend/commands/tsearchcmds.c | 95 ++++++++++++++++++++++++-----------
src/test/regress/expected/tsdicts.out | 34 +++++++++++++
src/test/regress/sql/tsdicts.sql | 30 +++++++++++
src/tools/pgindent/typedefs.list | 1 +
4 files changed, 130 insertions(+), 30 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2024-01-31 04:17:19 | pgsql: Fix various issues with ALTER TEXT SEARCH CONFIGURATION |
Previous Message | David Rowley | 2024-01-31 03:05:47 | Re: pgsql: Temporary patch to help debug pg_walsummary test failures. |