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

From Thomas Kellerer
Subject Re: Using COPY FROM on a subset of the file's column
Date
Msg-id k7nv58$1f3$1@ger.gmane.org
Whole thread Raw
In response to Re: Using COPY FROM on a subset of the file's column  (Craig Ringer <craig@2ndQuadrant.com>)
List pgsql-general
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



pgsql-general by date:

Previous
From: Craig Ringer
Date:
Subject: Re: Using COPY FROM on a subset of the file's column
Next
From: Jayadevan M
Date:
Subject: Oracle to PostgreSQL replication with Goldengate