From: | Thomas Kellerer <spam_eater(at)gmx(dot)net> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Using COPY FROM on a subset of the file's column |
Date: | 2012-11-11 10:37:49 |
Message-ID: | k7nv58$1f3$1@ger.gmane.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Jayadevan M | 2012-11-11 15:20:48 | Oracle to PostgreSQL replication with Goldengate |
Previous Message | Craig Ringer | 2012-11-11 10:23:11 | Re: Using COPY FROM on a subset of the file's column |