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.
right, that was what I was hoping fro.
> - \copy into a view that had a view trigger (or possibly rules;
> untested) to rewrite the incoming inserts and store them in the real
> target table; or
> - Just \copy into an UNLOGGED or TEMPORARY table then INSERT INTO ...
> SELECT the data to the real destination.
Thanks for the tips, I do have another option to use an external tool that will let me do that without problem.
The COPY solution would have been faster though, but it's a one-off thing anyway.
Regards
Thomas