I have a CSV file from which I am trying to use the Postgres COPY to populate a table from this CSV file. One of the columns of the NEXT_VISIT table has a data_type date. Some of the corresponding fields in the CSV file that must be included in this date column have null values.
The Copy command is executed:
COPY "VISIT_STAGING_TABLE" from E'C:\\Users\\Sir Codealot\\Desktop\\rufijihdss-2007-2010\\rufijihdss\\VISIT_TEST.CSV' CSV HEADER
When I run this command, I get an error:
ERROR: invalid input syntax for type date: "" CONTEXT: COPY VISIT_STAGING_TABLE, line 2, column NEXT_VISIT: "" ********** Error ********** ERROR: invalid input syntax for type date: "" SQL state: 22007 Context: COPY VISIT_STAGING_TABLE, line 2, column NEXT_VISIT: ""
How do I run a copy command and force Postgres to accept that some of the fields in the CSV file corresponding to NEXT_VISIT have a value of "" ?
source share