Re: copy files to postgresql - Mailing list pgsql-sql

From Tom Lane
Subject Re: copy files to postgresql
Date
Msg-id 15114.1028642467@sss.pgh.pa.us
Whole thread Raw
In response to Re: copy files to postgresql  (Jeff Eckermann <jeff_eckermann@yahoo.com>)
List pgsql-sql
Jeff Eckermann <jeff_eckermann@yahoo.com> writes:
> I believe that soon-to-be-released version 7.3 will
> have the ability to import data to specific columns,
> as you are trying to do.  For now, you will have to
> edit your input file to insert values (even if null)
> for the missing columns.

A usually-easier way is to make a temp table that matches the column
format of the source file, COPY into that, and then doINSERT INTO finaltable SELECT foo,bar,... FROM temptable
In the INSERT/SELECT it's trivial to do any rearrangement you want.

7.3 will add some more flexibility to COPY, but it only saves a
step, doesn't really do anything you can't do with a temp table.
        regards, tom lane


pgsql-sql by date:

Previous
From: Bruno Wolff III
Date:
Subject: Re: Transitive Closure
Next
From: Oleg Bartunov
Date:
Subject: Re: Transitive Closure