pgsql: Remove dead encoding-conversion functions. - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Remove dead encoding-conversion functions.
Date
Msg-id E1hjSmO-0000c7-89@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Remove dead encoding-conversion functions.

The code for conversions SQL_ASCII <-> MULE_INTERNAL and
SQL_ASCII <-> UTF8 was unreachable, because we long ago changed
the wrapper functions pg_do_encoding_conversion() et al so that
they have hard-wired behaviors for conversions involving SQL_ASCII.
(At least some of those fast paths date back to 2002, though it
looks like we may not have been totally consistent about this until
later.)  Given the lack of complaints, nobody is dissatisfied with
this state of affairs.  Hence, let's just remove the unreachable code.

Also, change CREATE CONVERSION so that it rejects attempts to
define such conversions.  Since we consider that SQL_ASCII represents
lack of knowledge about the encoding in use, such a conversion would
be semantically dubious even if it were reachable.

Adjust a couple of regression test cases that had randomly decided
to rely on these conversion functions rather than any other ones.

Discussion: https://postgr.es/m/41163.1559156593@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/0ab1a2e39b6f65b0f6a5879605ddbf12f9f50de4

Modified Files
--------------
doc/src/sgml/charset.sgml                          |  6 ++-
doc/src/sgml/func.sgml                             | 24 ---------
doc/src/sgml/ref/create_conversion.sgml            | 22 +++++---
src/backend/commands/conversioncmds.c              | 12 +++++
src/backend/utils/mb/conv.c                        | 45 ----------------
src/backend/utils/mb/conversion_procs/Makefile     |  4 +-
.../mb/conversion_procs/ascii_and_mic/Makefile     | 13 -----
.../conversion_procs/ascii_and_mic/ascii_and_mic.c | 60 ---------------------
.../mb/conversion_procs/utf8_and_ascii/Makefile    | 13 -----
.../utf8_and_ascii/utf8_and_ascii.c                | 62 ----------------------
src/include/catalog/catversion.h                   |  2 +-
src/include/catalog/pg_conversion.dat              | 12 -----
src/include/catalog/pg_proc.dat                    | 20 -------
src/include/mb/pg_wchar.h                          |  2 -
src/test/regress/expected/alter_table.out          |  6 +--
src/test/regress/expected/object_address.out       |  4 +-
src/test/regress/sql/alter_table.sql               |  4 +-
src/test/regress/sql/object_address.sql            |  2 +-
18 files changed, 44 insertions(+), 269 deletions(-)


pgsql-committers by date:

Previous
From: Tomas Vondra
Date:
Subject: pgsql: Remove unused variable in statext_mcv_serialize()
Next
From: Tom Lane
Date:
Subject: pgsql: Remove unreferenced function declarations.