With z/OS DB2, you can store the NULL byte (x'00') into character columns; however, PostgreSQL does not allow this. To work
around this limitation:
- Store your tables in a UTF-8 database
In a UTF-8 database, the NULL byte is replaced with UTF-8 value (x'C680') when doing DML in an SQL program, when using database
migration tools provided by AWS, and when using the MBDT LOAD and UNLOAD utilities.
- Compile programs with the SQL(ALLOWNULLCHAR) compiler directive
Important: If your application requires NULL byte support for a CHAR field, additional configuration is required. See
ALLOWNULLCHAR for details.
- Set environment variable PGCLIENTENCODING=UTF8
- Use the PostgreSQL ODBC Driver (UNICODE)
- Set your Windows or Linux system locale to appropriate the Single-byte Character Set (SBCS) value:
- For Windows, the system locale is defined in the Windows
Control Panel. For example,
English(United States) uses Windows SBCS code page 1252.
- For Linux, the system locale is defined by the value of the LANG environment variable. For example, setting
LANG=en-US.iso8859-1 or
LANG=en_US.iso8859-15 uses Linux SBCS code page 819 (non EURO) or 923 (EURO).
- For both Windows and Linux platforms, we provide special conversion tables containing SBCS code pages that map NULL byte to
UTF-8 value (x'C680'). You must install these conversion tables and configure your system to find them. For complete instructions,
see
To install CCSID tables for HCOPG.
Note: If using CHARSET(EBCDIC) for your SQL programs, AWS provides EBCDIC collation(s) for your UTF-8 database. See your AWS documentation
for more information.