| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> | 
|---|---|
| To: | Jeff Eckermann <jeff_eckermann(at)yahoo(dot)com> | 
| Cc: | John Zhang <jzhang(at)jimmy(dot)harvard(dot)edu>, pgsql-sql(at)postgresql(dot)org | 
| Subject: | Re: copy files to postgresql | 
| Date: | 2002-08-06 14:01:07 | 
| Message-ID: | 15114.1028642467@sss.pgh.pa.us | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-sql | 
Jeff Eckermann <jeff_eckermann(at)yahoo(dot)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 do
	INSERT 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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Bruno Wolff III | 2002-08-06 14:06:29 | Re: Transitive Closure | 
| Previous Message | Jeff Eckermann | 2002-08-06 13:23:25 | Re: copy files to postgresql |