I'm trying to import a .txt file into PostgreSQL. The txt file has 6 columns:
Laboratory_Name Laboratory_ID Facility ZIP_Code City State
And 213 rows.
I'm trying to use \copy
to put the contents of this file into a table called doe2
in PostgreSQL using this command:
\copy DOE2 FROM '/users/nathangroom/desktop/DOE_inventory5.txt' (DELIMITER(' '))
It gives me this error:
missing data for column "facility"
I've looked all around for what to do when encountering this error and nothing has helped. Has anyone else encountered this?
\COPY
command. Something likeCOPY table_name (col1, col2) FROM '/path/to/file.csv'
. And no, usingHEADERS
doesn't actually read and sort the headers like you might expect, it just tells postgres to ignore the first row of the file.