pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix various issues with ALTER TEXT SEARCH CONFIGURATION
6+ messages / 1 participants
[nested] [flat]

* pgsql: Fix various issues with ALTER TEXT SEARCH CONFIGURATION
@ 2024-01-31 04:17  Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 6+ messages in thread

From: Michael Paquier @ 2024-01-31 04:17 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Fix various issues with ALTER TEXT SEARCH CONFIGURATION
@ 2024-01-31 04:17  Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 6+ messages in thread

From: Michael Paquier @ 2024-01-31 04:17 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/dde5b01c33f9a8c41f5598dd5d4db718df171eed

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(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Fix various issues with ALTER TEXT SEARCH CONFIGURATION
@ 2024-01-31 04:17  Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 6+ messages in thread

From: Michael Paquier @ 2024-01-31 04:17 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/f33e83285a1419bf083ec0a6913268d454ce22e9

Modified Files
--------------
src/backend/commands/tsearchcmds.c    | 97 ++++++++++++++++++++++++-----------
src/test/regress/expected/tsdicts.out | 34 ++++++++++++
src/test/regress/sql/tsdicts.sql      | 30 +++++++++++
src/tools/pgindent/typedefs.list      |  1 +
4 files changed, 132 insertions(+), 30 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Fix various issues with ALTER TEXT SEARCH CONFIGURATION
@ 2024-01-31 04:17  Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 6+ messages in thread

From: Michael Paquier @ 2024-01-31 04:17 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/3e91dba8b079c02dc5204108c7e797b402c75779

Modified Files
--------------
src/backend/commands/tsearchcmds.c    | 97 ++++++++++++++++++++++++-----------
src/test/regress/expected/tsdicts.out | 34 ++++++++++++
src/test/regress/sql/tsdicts.sql      | 30 +++++++++++
src/tools/pgindent/typedefs.list      |  1 +
4 files changed, 132 insertions(+), 30 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Fix various issues with ALTER TEXT SEARCH CONFIGURATION
@ 2024-01-31 04:17  Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 6+ messages in thread

From: Michael Paquier @ 2024-01-31 04:17 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/0561097822a1462391f4f44665ecf831ce523b6e

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(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Fix various issues with ALTER TEXT SEARCH CONFIGURATION
@ 2024-01-31 04:17  Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 6+ messages in thread

From: Michael Paquier @ 2024-01-31 04:17 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/4d0e8a008bdcaf09c89585c59e860cdc0a837a3b

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(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2024-01-31 04:17 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-01-31 04:17 pgsql: Fix various issues with ALTER TEXT SEARCH CONFIGURATION Michael Paquier <michael@paquier.xyz>
2024-01-31 04:17 pgsql: Fix various issues with ALTER TEXT SEARCH CONFIGURATION Michael Paquier <michael@paquier.xyz>
2024-01-31 04:17 pgsql: Fix various issues with ALTER TEXT SEARCH CONFIGURATION Michael Paquier <michael@paquier.xyz>
2024-01-31 04:17 pgsql: Fix various issues with ALTER TEXT SEARCH CONFIGURATION Michael Paquier <michael@paquier.xyz>
2024-01-31 04:17 pgsql: Fix various issues with ALTER TEXT SEARCH CONFIGURATION Michael Paquier <michael@paquier.xyz>
2024-01-31 04:17 pgsql: Fix various issues with ALTER TEXT SEARCH CONFIGURATION Michael Paquier <michael@paquier.xyz>

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