Re: OID's

From: Tino Wildenhain <tino(at)wildenhain(dot)de>
To: Holger Klawitter <lists(at)klawitter(dot)de>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: OID's
Date: 2004-11-16 13:41:52
Message-ID: 1100612512.21062.649.camel@sabrina.peacock.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, 2004-11-16 at 12:32, Holger Klawitter wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
>
> A little bit OT, but:
> is there a way of removing duplicate rows in a table without OIDs?
>

ALTER TABLE ... ADD COLUMN myoid int;
CREATE TEMP SEQUENCE myoidsequence;
UPDATE ... SET myoid=nextval('myoidsequence');

then do the usual

SELECT a.* FROM ... a, ... b WHERE a.something=b.something AND
a.myoid<b.myoid;

Dance and if you are done with it,
ALTER TABLE ... DROP COLUMN myoid;
DROP TEMP SEQUENCE myoidsequence;

HTH
Tino

In response to

  • Re: OID's at 2004-11-16 11:32:07 from Holger Klawitter

Browse pgsql-general by date

  From Date Subject
Next Message Joolz 2004-11-16 13:42:24 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Previous Message Richard Huxton 2004-11-16 13:35:39 Re: PL/pgsql - getting row from record