Re: [INTERFACES] Deleting duplicate records

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Paul S(dot) Ganney" <paul(dot)ganney(at)dial(dot)pipex(dot)com>
Cc: pgsql-interfaces(at)postgreSQL(dot)org
Subject: Re: [INTERFACES] Deleting duplicate records
Date: 1999-12-07 18:01:54
Message-ID: 24023.944589714@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

"Paul S. Ganney" <paul(dot)ganney(at)dial(dot)pipex(dot)com> writes:
> I've managed to get some duplicate records in a table and am having
> problems getting rid of them (as there's nothing unique to SELECT on).
> Any ideas?

There's always the OID. Do
select oid,* from table ...
to see it, and get rid of the unwanted rows with
delete from table where oid = nnnn;

> And whilst I'm at it - any ideas on a scheme for preventing duplicates?

Unique index on whatever combination of fields is your primary key?

regards, tom lane

Browse pgsql-interfaces by date

  From Date Subject
Next Message Ross J. Reedstrom 1999-12-07 19:24:11 Re: [INTERFACES] locking on database updates
Previous Message Tom Lane 1999-12-07 17:59:33 Re: [INTERFACES] locking on database updates