A null character, or ASCII NUL, has code point zero and is commonly written as hexadecimal 00 (\x00) or octal 0 (\0). PostgreSQL rejects it in string constants, even with UTF8 enabled. section 10.3
A migration that fails after encoding conversion
A MySQL dump may contain NUL characters that PostgreSQL refuses during import. After converting a latin1 dump to UTF-8, retrying with psql can still produce `ERROR: invalid byte sequence for encoding "UTF8": 0x00`. The issue is not solved by selecting UTF8: PostgreSQL accepts valid UTF-8 but rejects ASCII zero, while another database may accept it. section 10.3
ERROR: invalid byte sequence for encoding "UTF8": 0x00
Use the representative PostgreSQL error to recognize a NUL-character failure during import. section 10.3
tr -d '\000' < prod_dump_utf8.sql > prod_dump_clean.sql
sed 's/\x0//g' prod_dump_utf8.sql > prod_dump_clean.sql
Remove NUL bytes from a converted dump with tr or sed before retrying the import. section 10.3
