Please tell me about character code conversion. - Mailing list pgsql-general

From 久門 愛
Subject Please tell me about character code conversion.
Date
Msg-id 002f01d758f2$3e139680$ba3ac380$@ryobi.co.jp
Whole thread Raw
Responses Re: Please tell me about character code conversion.  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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





pgsql-general by date:

Previous
From: saket bansal
Date:
Subject: Noinheritance with superuser
Next
From: Tom Lane
Date:
Subject: Re: Noinheritance with superuser