COPY and duplicates

Lists: pgsql-general
From: wsheldah(at)lexmark(dot)com
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Visual Modeling programs
Date: 2001-07-13 13:20:36
Message-ID: 200107131320.JAA04169@interlock2.lexmark.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

It looks like they aren't quite ready for a full release yet, and may not even
be ready to save changes made to the table schema, based on what I read at
http://dbdesigner.sourceforge.net/. It does look promising though.

Bruce Momjian <pgman%candle(dot)pha(dot)pa(dot)us(at)interlock(dot)lexmark(dot)com> on 07/12/2001
05:39:29 PM

To: Morgan Curley <mcurley%e4media(dot)com(at)interlock(dot)lexmark(dot)com>
cc: pgsql-general%postgresql(dot)org(at)interlock(dot)lexmark(dot)com (bcc: Wesley
Sheldahl/Lex/Lexmark)
Subject: Re: [GENERAL] Visual Modeling programs

> Anyone know of any visual modelling apps (like CA's ERWin ) that work well
> with pg?
> I Have been using erwin but just discovered it isn't creating my pk, fk or
> unique constraints.
> I am using the odbc v3.0 target repository option in erwin.

Dbdesigner.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://www.postgresql.org/search.mpl


From: Ryan Mahoney <ryan(at)paymentalliance(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: COPY and duplicates
Date: 2001-07-13 13:40:24
Message-ID: 5.0.2.1.0.20010713093044.02acd640@paymentalliance.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Is it possible for the COPY command to warn about duplicate key violations
(and not insert them...) but still proceed inserting the rows that do not
cause a violation? If not, what is the quickest way to deal with this problem?

TIA!

-Ryan Mahoney

Attachment Content-Type Size
unknown_filename text/plain 166 bytes

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Ryan Mahoney <ryan(at)paymentalliance(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: COPY and duplicates
Date: 2001-07-13 16:01:28
Message-ID: 20010713110128.A13973@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

On Fri, Jul 13, 2001 at 09:40:24AM -0400,
Ryan Mahoney <ryan(at)paymentalliance(dot)net> wrote:
> Is it possible for the COPY command to warn about duplicate key violations
> (and not insert them...) but still proceed inserting the rows that do not
> cause a violation? If not, what is the quickest way to deal with this problem?

You could copy the data into a temporary table and then insert just
run record from a set with the same key into the real table.


From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Ryan Mahoney <ryan(at)paymentalliance(dot)net>, pgsql-general(at)postgresql(dot)org
Subject: Re: COPY and duplicates
Date: 2001-07-13 18:10:43
Message-ID: 20010713131043.A14421@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

On Fri, Jul 13, 2001 at 11:01:28AM -0500,
Bruno Wolff III <bruno(at)wolff(dot)to> wrote:
> On Fri, Jul 13, 2001 at 09:40:24AM -0400,
> Ryan Mahoney <ryan(at)paymentalliance(dot)net> wrote:
> > Is it possible for the COPY command to warn about duplicate key violations
> > (and not insert them...) but still proceed inserting the rows that do not
> > cause a violation? If not, what is the quickest way to deal with this problem?
>
> You could copy the data into a temporary table and then insert just
> run record from a set with the same key into the real table.

As Ryan pointed out to me, I bolixed up the grammer in my response.

You can do want you want using copy to load a temporary table that
doesn't have a unique key constraint and then use insert to insert
data from a select on the temporary table using the distinct on clause
to pick one record from a set of records with the same key.