Unique constaint violated without being violated

From: Sebastian Tennant <sebyte(at)smolny(dot)plus(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Unique constaint violated without being violated
Date: 2008-12-06 15:27:48
Message-ID: zlj9qq6j.fsf@vps203.linuxvps.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi all,

Here's an odd one:

itidb=> \d joblist;
Table "public.joblist"
Column | Type | Modifiers
-------------------+--------------------------+-----------
full_name | character varying(64) | not null
email_address | character varying(64) | not null
username | character varying(12) |
password | character varying(12) |
recruiter | boolean | not null
subscribed | boolean | not null
verified | boolean | not null
created_at | timestamp with time zone | not null
updated_at | timestamp with time zone | not null
verification_code | character varying(24) |
alumni | boolean |
Indexes:
"joblist_pkey" PRIMARY KEY, btree (email_address)
"joblist_username_key" UNIQUE, btree (username)

itidb=> update joblist set (full_name, email_address, recruiter,
itidb(> subscribed, verified, created_at, updated_at) =
itidb-> ('[name hidden]', '[email address hidden]', false, true
itidb(> true, current_timestamp(0), current_timestamp(0));
ERROR: duplicate key value violates unique constraint "joblist_pkey"

itidb=> select * from joblist where
itidb-> email_address='[email address hidden]';
(No rows)

email_address is the primary key of this table (because the manual says
every table should have one :-) and the unique aspect of this primary
key is being violated when I try to enter the (hidden) email address
above.

But the email address hasn't already been entered into this table, as
shown by the output of the select command... so why the error?

Is my database corrupted somehow, or am I just losing my mind?

What course of action do you suggest I follow?

Sebastian

P.S. I've checked three times now, and I'm definitely using the same
email address in the update command and the select command, i.e., a
typo is not what's causing this.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Merlin Moncure 2008-12-06 15:36:01 Re: Unique constaint violated without being violated
Previous Message Merlin Moncure 2008-12-06 13:38:43 Re: visibility map - what do i miss?