PG COPY error: invalid input syntax for integer

前端 未结 12 1778
走了就别回头了
走了就别回头了 2020-12-29 01:02

Running COPY results in ERROR: invalid input syntax for integer: \"\" error message for me. What am I missing?

My /tmp/people.cs

12条回答
  •  独厮守ぢ
    2020-12-29 01:40

    There is a way to solve "", the quoted null string as null in integer column, use FORCE_NULL option :

    \copy table_name FROM 'file.csv' with (FORMAT CSV, FORCE_NULL(column_name));
    

    see postgresql document, https://www.postgresql.org/docs/current/static/sql-copy.html

提交回复
热议问题