From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jeff Eckermann <jeff_eckermann@yahoo.com>
Cc: John Zhang <jzhang@jimmy.harvard.edu>
Cc: pgsql-sql@postgresql.org
Subject: Re: copy files to postgresql
Date: Tue, 06 Aug 2002 10:01:07 -0400
Message-ID: <15114.1028642467@sss.pgh.pa.us> (raw)
In-Reply-To: <20020806132325.38254.qmail@web20809.mail.yahoo.com>
References: <20020806132325.38254.qmail@web20809.mail.yahoo.com>
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 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, jeff_eckermann@yahoo.com, jzhang@jimmy.harvard.edu
Subject: Re: copy files to postgresql
In-Reply-To: <15114.1028642467@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox