How do I list all available encoding types available in postgreSQL?
-
08-10-2020 - |
题
SELECT datname, pg_encoding_to_char(encoding)
FROM pg_database;
…lists all the databases, each with its encoding type.
However, I am trying to find out what are all the encoding types available in the PostgreSQL server. Can I query for all available encoding types?
Or are the only encoding types ever available listed in Chapter 23.3 Character Set Support?
解决方案
Or are the only encoding types ever available listed in Chapter 23.3 Character Set Support?
Yes. You can see the full list in the source code, if you insist
That said, it's highly abnormal to use any of these encoding except UTF-8 as an internal storage format. Unicode should support all of the useful characters in all of the other encodings. If you find UTF-8 acceptable, the only purpose these other encoding serve is to eliminate the need to create an ETL script for the COPY
statement.
其他提示
I think it is OK to check the supported client encoding by the following SQL query.
SELECT DISTINCT pg_catalog.pg_encoding_to_char(conforencoding)
from pg_catalog.pg_conversion;