Using COPY FROM on a subset of the file's column - Mailing list pgsql-general

From Thomas Kellerer
Subject Using COPY FROM on a subset of the file's column
Date
Msg-id k7nrc9$7l8$1@ger.gmane.org
Whole thread Raw
Responses Re: Using COPY FROM on a subset of the file's column  (Craig Ringer <craig@2ndQuadrant.com>)
List pgsql-general
Hello,

I'm trying to import a text file into a table using the COPY command.

The text file contains four columns: id, col_1, col_2, col_3 (in that order).
My target table only has id and col_1.

 From the documentation I assumed that the following statement

   copy foo (id, col_1)
   from 'foo.txt'
   with (format csv, delimiter ';', header true);

would only import id and col_1, but instead it fails with "ERROR:  extra data after last expected column".

Am I missing something, or is this a limitation of the COPY command?

Regards
Thomas

pgsql-general by date:

Previous
From: Craig Ringer
Date:
Subject: Re: Running out of memory while making a join
Next
From: Craig Ringer
Date:
Subject: Re: Using COPY FROM on a subset of the file's column