summaryrefslogtreecommitdiff
path: root/src/backend/utils/mb/conv.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2019-07-05 14:17:27 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2019-07-05 14:17:27 -0400
commit0ab1a2e39b6f65b0f6a5879605ddbf12f9f50de4 (patch)
tree5aa82c5c13706d9df7faf787d7c8071478e33dac /src/backend/utils/mb/conv.c
parentef777cb093e8cb45dd3ae9d3f1499c765147c1dd (diff)
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
Diffstat (limited to 'src/backend/utils/mb/conv.c')
-rw-r--r--src/backend/utils/mb/conv.c45
1 files changed, 0 insertions, 45 deletions
diff --git a/src/backend/utils/mb/conv.c b/src/backend/utils/mb/conv.c
index f2b51acffe2..3ecc92b0a6a 100644
--- a/src/backend/utils/mb/conv.c
+++ b/src/backend/utils/mb/conv.c
@@ -133,51 +133,6 @@ mic2latin(const unsigned char *mic, unsigned char *p, int len,
/*
- * ASCII ---> MIC
- *
- * While ordinarily SQL_ASCII encoding is forgiving of high-bit-set
- * characters, here we must take a hard line because we don't know
- * the appropriate MIC equivalent.
- */
-void
-pg_ascii2mic(const unsigned char *l, unsigned char *p, int len)
-{
- int c1;
-
- while (len > 0)
- {
- c1 = *l;
- if (c1 == 0 || IS_HIGHBIT_SET(c1))
- report_invalid_encoding(PG_SQL_ASCII, (const char *) l, len);
- *p++ = c1;
- l++;
- len--;
- }
- *p = '\0';
-}
-
-/*
- * MIC ---> ASCII
- */
-void
-pg_mic2ascii(const unsigned char *mic, unsigned char *p, int len)
-{
- int c1;
-
- while (len > 0)
- {
- c1 = *mic;
- if (c1 == 0 || IS_HIGHBIT_SET(c1))
- report_untranslatable_char(PG_MULE_INTERNAL, PG_SQL_ASCII,
- (const char *) mic, len);
- *p++ = c1;
- mic++;
- len--;
- }
- *p = '\0';
-}
-
-/*
* latin2mic_with_table: a generic single byte charset encoding
* conversion from a local charset to the mule internal code.
*