Skip site navigation (1) Skip section navigation (2)

Re: Can COPY update or skip existing records?

From: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>
To: "Glenn Gillen" <glenn(dot)gillen(at)gmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Can COPY update or skip existing records?
Date: 2008-10-01 02:30:47
Message-ID: dcc563d10809301930y1dcec1bx6499f8ca2bdba7c3@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-sql
On Tue, Sep 30, 2008 at 6:16 AM, Glenn Gillen <glenn(dot)gillen(at)gmail(dot)com> wrote:
> Hey all,
>
> I've got a table with a unique constraint across a few fields which I
> need to regularly import a batch of data into. Is there a way to do it
> with COPY without getting conflicts on the unique contraint? I have no
> was of being certain that some of the data I'm trying to load isn't in
> the table already.
>
> Ideally I'd like it to operate like MySQL's on_duplicate_key_update
> option, but for now I'll suffice with just ignoring existing rows and
> proceeding with everything else.

Look into pg_loader, I believe it has that capability.

In response to

pgsql-sql by date

Next:From: Sestak, John SDate: 2008-10-01 15:06:21
Subject: Accessing elements of bytea[] always returns NULL
Previous:From: Gurjeet SinghDate: 2008-10-01 02:27:31
Subject: Re: Can COPY update or skip existing records?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group