Thread: duplicate entries on primary key

duplicate entries on primary key

From
Marcin Gil
Date:
Hi!
Using PHP, Pear::DB i managed to put duplicate entries
on a primary key column. My PostgreSQL version is 7.4 self compiled,
running on Slackware 9.1.

Doesn't PK implicate Unique in new version?
--
   Marcin Gil
   marcin.gil @ audax.com.pl, tel. 694972082
   OIS Audax Sp. z o.o., ul. Barlickiego 4, 97-200 Tomaszów Mazowiecki
   tel/fax (44) 7247530, 7244401

Re: duplicate entries on primary key

From
Tom Lane
Date:
> Using PHP, Pear::DB i managed to put duplicate entries
> on a primary key column.

Can you show us a reproducible test case?

            regards, tom lane

Re: duplicate entries on primary key

From
Josh Berkus
Date:
Marcin,

> Using PHP, Pear::DB i managed to put duplicate entries
> on a primary key column. My PostgreSQL version is 7.4 self compiled,
> running on Slackware 9.1.
>
> Doesn't PK implicate Unique in new version?

Yes.  I suspect that your primary key constraint got dropped somehow.

Please examine your table to make sure that the key is still there.  In PSQL,
the way to do this is to look at \dt <table_name>.

If you find the key still in place, please post the table definition from PSQL
and the offending rows.

--
Josh Berkus
Aglio Database Solutions
San Francisco

Re: duplicate entries on primary key

From
Stephan Szabo
Date:
On Mon, 8 Dec 2003, Marcin Gil wrote:

> Using PHP, Pear::DB i managed to put duplicate entries
> on a primary key column. My PostgreSQL version is 7.4 self compiled,
> running on Slackware 9.1.
>
> Doesn't PK implicate Unique in new version?

Also note in addition to other messages, pk/unique and inheritance have
issues right now.  If you're using inheritance you may not have the
constraints you think you do since pk/unique constraints are not
inherited.

Re: duplicate entries on primary key

From
Marcin Gil
Date:
Sorry for not answering, but I've been cut from the net.
I can't send you my database, because since then I dropped it
and recreated.
As my thought it has something to do with triggers. While running
a live database I've created/dropped a trigger function a few times
that operated on that specific table.

As far as I remember pk constraint was there.
I wish I could help you more...
--
   Marcin Gil
   marcin.gil @ audax.com.pl, tel. 694972082
   OIS Audax Sp. z o.o., ul. Barlickiego 4, 97-200 Tomaszów Mazowiecki
   tel/fax (44) 7247530, 7244401