pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Paul S. Ganney <paul.ganney@dial.pipex.com>
Cc: pgsql-interfaces@postgreSQL.org
Subject: Re: [INTERFACES] Deleting duplicate records
Date: Tue, 07 Dec 1999 13:01:54 -0500
Message-ID: <24023.944589714@sss.pgh.pa.us> (raw)
In-Reply-To: <384D39E6.6459@dial.pipex.com>

"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



view thread (2+ messages)

Message-ID: <24023.944589714@sss.pgh.pa.us>
Permalink:  ../24023.944589714@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/24023.944589714@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: tgl@sss.pgh.pa.us, paul.ganney@dial.pipex.com
  Subject: Re: [INTERFACES] Deleting duplicate records
  In-Reply-To: <24023.944589714@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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