Please tell me about character code conversion.

From: 久門 愛 <kumon(dot)ai(at)ryobi(dot)co(dot)jp>
To: <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Please tell me about character code conversion.
Date: 2021-06-04 03:32:27
Message-ID: 002f01d758f2$3e139680$ba3ac380$@ryobi.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,
Please tell me about character code conversion.
I am currently using Postgres 13.3.
I would like to set my own character code conversion as DEFAULT CONVERSION.
Since there is a CONVERSION provided by Postgres by default, the following
error will occur when executing CREATE CONVERSION.
-----------------------------
postgres=# CREATE DEFAULT CONVERSION pg_catalog.myconv_sjis_to_utf8 FOR
'SJIS' TO 'UTF8' FROM myconv_sjis_to_utf8;
ERROR: default conversion for SJIS to UTF8 already exists
postgres=#
-----------------------------

As a method to change the conversion provided by default, execute the
following SQL statement and after executing CREATE CONVERSION
I am trying to update the system catalog with an UPDATE statement. Is there
any problem with this method?
-----------------------------
CREATE CONVERSION pg_catalog.myconv_sjis_to_utf8 FOR 'SJIS' TO 'UTF8' FROM
myconv_sjis_to_utf8;
UPDATE pg_conversion SET condefault='f' WHERE conname='sjis_to_utf8';
UPDATE pg_conversion SET condefault='t' WHERE conname='myconv_sjis_to_utf8';
-----------------------------

Thanks
Ai

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2021-06-04 03:59:12 Re: Noinheritance with superuser
Previous Message saket bansal 2021-06-04 03:13:05 Noinheritance with superuser