Setting the Character Set in Greenplum

At the initialization time gpinitsystem defines the default character set for a Greenplum Database system by reading the setting of the ENCODING parameter in the gp_init_config file . 

The default character set is UNICODE or UTF8.

You can create a database with a different character set besides what is used as the system-wide default. For example:

=> CREATE DATABASE sachi WITH ENCODING 'LATIN1';

Important: Although you can specify any encoding you want for a database, it is unwise to choose an encoding that is not what is expected by the locale you have selected. The LC_COLLATE and LC_CTYPE settings imply a particular encoding, and locale-dependent operations (such as sorting) are likely to misinterpret data that is in an incompatible encoding.

Since these locale settings are frozen by gpinitsystem, the apparent flexibility to use different encodings in different databases is more theoretical than real.
One way to use multiple encodings safely is to set the locale to C or POSIX during initialization time, thus disabling any real locale awareness.
Comments