pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Deleting duplicate records
2+ messages / 2 participants
[nested] [flat]

* Deleting duplicate records
@ 1999-12-07 16:46  Paul S. Ganney <paul.ganney@dial.pipex.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Paul S. Ganney @ 1999-12-07 16:46 UTC (permalink / raw)
  To: pgsql-interfaces

This probably sounds horribly trivial, but still...

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?

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

Paul.
-- 
-------------------------------------------
Expressed opinions are usually my own.
Especially if they're any good (of course).
-------------------------------------------




^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: [INTERFACES] Deleting duplicate records
@ 1999-12-07 18:01  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Paul S. Ganney <paul.ganney@dial.pipex.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 1999-12-07 18:01 UTC (permalink / raw)
  To: Paul S. Ganney <paul.ganney@dial.pipex.com>; +Cc: pgsql-interfaces

"Paul S. Ganney" <paul.ganney@dial.pipex.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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~1999-12-07 18:01 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1999-12-07 16:46 Deleting duplicate records Paul S. Ganney <paul.ganney@dial.pipex.com>
1999-12-07 18:01 ` Tom Lane <tgl@sss.pgh.pa.us>

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