Three possible causes:
-
One or more lines of your file has only 4 or fewer space characters (your delimiter).
-
One or more space characters have been escaped (inadvertently). Maybe with a backslash at the end of an unquoted value. For the (default)
textformat you are using, the manual explains:
Backslash characters (
\) can be used in theCOPYdata to quote data
characters that might otherwise be taken as row or column delimiters.
Output from COPY TO or pg_dump would not exhibit any of these faults when reading from a table with matching layout. But maybe your file has been edited or is from a different, faulty source?
- You are not using the file you think you are using. The
\copymeta-command of the psql command-line interface is a wrapper forCOPYand reads files local to the client. If your file lives on the server, use the SQL commandCOPYinstead.