Search code examples
databasepostgresqlcharacterbackuppg-dump

when I use pg_dump to back up postgres, an error occur, how can I get rid of this error?


The output message is here:

pg_dump: Dumping the contents of table "categorytype_show" failed: PQgetResult() failed. pg_dump: Error message from server: ERROR: character with byte sequence 0xef 0xbb 0xbf in encoding "UTF8" has no equivalent in encoding "GBK" pg_dump: The command was: COPY public.categorytype_show (categoryid, categorylevel, categoryname, categoryparentid, leafcategory, catalogenabled, autopayenabled, b2bvatenabled, bestofferenabled, expired, intlautosfixedcat, keywords, lsd, numofitems, orpa, orra, sellerguaranteeeligible, virtual, itemtype, isselect, imgurl, id, ctime) TO stdout;


Solution

  • They key is:

    ERROR: character with byte sequence 0xef 0xbb 0xbf in encoding "UTF8" has no equivalent in encoding "GBK"

    You have an encoding error. To overcome that, dump the data in UTF8 format as

    pg_dump -E UTF8
    

    Also consider using the -Fc option to pg_dump. More details at : https://www.postgresql.org/docs/9.1/static/app-pgdump.html