[GENERAL] Using COPY FROM on a subset of the file's column

2012-11-11 Thread Thomas Kellerer
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

Re: [GENERAL] Using COPY FROM on a subset of the file's column

2012-11-11 Thread Craig Ringer
On 11/11/2012 05:33 PM, Thomas Kellerer wrote: 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

Re: [GENERAL] Using COPY FROM on a subset of the file's column

2012-11-11 Thread Thomas Kellerer
Craig Ringer wrote on 11.11.2012 11:23: It seems like you want to be able to say something like this (imaginary) syntax: \copy test_copy (id, col1) FROM 'test.csv' CSV COLUMNS(1,2,IGNORE) or some similar way to provide a column mapping from the CSV columns to the output of the COPY command.