From: | Decibel! <decibel(at)decibel(dot)org> |
---|---|
To: | Ow Mun Heng <Ow(dot)Mun(dot)Heng(at)wdc(dot)com> |
Cc: | Postgresql General List <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Copy command and duplicate items (Support Replace?) |
Date: | 2007-08-15 18:04:29 |
Message-ID: | 20070815180429.GM54135@nasby.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Tue, Aug 14, 2007 at 10:50:33AM +0800, Ow Mun Heng wrote:
> Hi,
>
> Writing a script to pull data from SQL server into a flat-file (or just
> piped in directly to PG using Perl DBI)
>
> Just wondering if the copy command is able to do a replace if there are
> existing data in the Db already. (This is usually in the case of updates
> to specific rows and there be a timestamp indicating it has been changed
> etc.)
>
> In MySQL, the mysqlimport util has the --replace function which will
> replace the data if there is any event of a duplicate.
>
> Does PG support this?
No; you'll need to COPY into a temporary or staging table and then
proceed from there. Alternatively, you could use
http://pgfoundry.org/projects/pgloader/.
--
Decibel!, aka Jim Nasby decibel(at)decibel(dot)org
EnterpriseDB http://enterprisedb.com 512.569.9461 (cell)
From | Date | Subject | |
---|---|---|---|
Next Message | Ben | 2007-08-15 18:04:58 | Re: Best practice for: ERROR: invalid byte sequence for encoding "UTF8" |
Previous Message | Phoenix Kiula | 2007-08-15 18:04:08 | Re: pg_dump on local Windows, pg_restore on Linux? |