0
COPY population 
FROM '/Users/chittampalliyashaswini/Documents/population.csv'
DELIMITER ',' CSV HEADER;

I tried running this same command. I moved the population csv to the my documents folder.

This is the result I am getting.

ERROR:  invalid byte sequence for encoding "UTF8": 0x00
CONTEXT:  COPY population, line 1
********** Error **********

ERROR: invalid byte sequence for encoding "UTF8": 0x00
SQL state: 22021
Context: COPY population, line 1
Vivek S.
  • 19,945
  • 7
  • 68
  • 85
Yadu
  • 11
  • 3
  • Possible duplicate of [Postgres error on insert - ERROR: invalid byte sequence for encoding "UTF8": 0x00](http://stackoverflow.com/questions/1347646/postgres-error-on-insert-error-invalid-byte-sequence-for-encoding-utf8-0x0) – Hambone Feb 09 '16 at 04:18

1 Answers1

0

In short, there is no simple answer to this question.

As given here and here, this basically is about PostgreSQL's incapability to store a data in the column that you want it to. Ideally you should solve this by going back to the source, and change every instance of such a character and then take a re-dump and use that to restore the target DB once again.

The URLs given above, both give ways to do this, albeit agreeably they aren't very convenient.

Community
  • 1
  • 1
Robins Tharakan
  • 2,209
  • 19
  • 17