Urgent: Key constraints behaving weirdly

From: "Russell Garrett" <rg(at)tcslon(dot)com>
To: <pgsql-bugs(at)postgresql(dot)org>
Subject: Urgent: Key constraints behaving weirdly
Date: 2003-12-18 11:51:05
Message-ID: MKEGJINFADFODDNOKEJCOEGCENAA.rg@tcslon.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Your name : Russ Garrett
Your email address : russ(at)last(dot)fm

System Configuration
---------------------
Architecture (example: Intel Pentium) : P4 Xeon
Operating System (example: Linux 2.0.26 ELF) : Linux 2.4.22 ELF
PostgreSQL version (example: PostgreSQL-7.4) : PostgreSQL-7.4
Compiler used (example: gcc 2.95.2) : gcc version 3.2.2 20030222
(Red Hat Linux 3.2.2-5)

Please enter a FULL description of your problem:
------------------------------------------------

Constraints are being weird. The reproduction instructions speak for
themselves.
We're using this on a production database and we're understandably getting a
bit edgy.

Please describe a way to repeat the problem. Please try to provide a
concise reproducible example, if at all possible:
----------------------------------------------------------------------

last=> \d profile
...
Indexes:
"profile_pkey" primary key, btree (id)

last=> \di+ profile_pkey
List of relations
Schema | Name | Type | Owner | Description | Table
--------+--------------+-------+--------+-------------+---------
public | profile_pkey | index | lastfm | | profile
(1 row)

last=> UPDATE profile SET lastsongtime=now(), r1=r1+0, r2=r2+0, r3=r3+0,
r4=r4+0, r5=r5+0, scrobcount=scrobcount+1 WHERE id=1017057;
ERROR: duplicate key violates unique constraint "profile_pkey"

last=> SELECT * FROM profile WHERE id=1017057;
id | user | name | description | songspaminterval |
lastsongtime | entropy | newbie | creationdate | r1 | r2 |
r3 | r4 | r5 | scrobcount | newbielistenas | e1 | e2 | e3 | e4 | e5 |
numdisconnections | totalstreamtime
---------+---------+---------+-------------+------------------+-------------
--------+---------+--------+----------------------------+----+----+----+----
+----+------------+----------------+----+----+----+-----+----+--------------
-----+-----------------
1017057 | 1017075 | Default | | 60 | 2003-12-18
04:32:34 | 1 | f | 2003-12-17 23:57:01.582757 | 0 | 0 | 0 | 0
| 0 | 23 | | 2 | 0 | 0 | 219 | 0 |
0 | 0
(1 row)

last=>

If you know how this problem might be fixed, list the solution below:
---------------------------------------------------------------------

No idea :).

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Puneet Paul 2003-12-18 12:21:36 plpgsql For SQLQuery Loop Flags Error
Previous Message Mark Shewmaker 2003-12-18 09:28:35 Re: SELECT FOR UPDATE differs inside and outside a pl/pgsql