Re: count (*)

From: "Albe Laurenz" <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "alonso *EXTERN*" <test895(at)gmail(dot)com>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: count (*)
Date: 2007-09-17 07:01:50
Message-ID: D960CB61B694CF459DCFB4B0128514C2360F1C@exadv11.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

alonso wrote:
> I've got it, but I don't know the reason of it.
> In the database table the records have duplicated and I've
> two rows for
> every primary key - with different OIDs.
> Very strange however...

Very strange indeed.

Are you positive that there is a primary key constraint on
the column? Can you show some evidence?

> Is there any safe method to get rid of only one of each
> duplicated row?

If "id" is your "primary key":

DELETE FROM test USING test a
WHERE test.id = a.id AND test.oid > a.oid;

Yours,
Laurenz Albe

In response to

  • count (*) at 2007-09-14 08:26:38 from alonso

Browse pgsql-general by date

  From Date Subject
Next Message Josh Harrison 2007-09-17 12:35:48 postgres catalog files problem
Previous Message Troy Rasiah 2007-09-17 04:13:09 Re: Time Zone design issues