Unique constaint violated without being violated - Mailing list pgsql-general

From Sebastian Tennant
Subject Unique constaint violated without being violated
Date
Msg-id zlj9qq6j.fsf@vps203.linuxvps.org
Whole thread Raw
Responses Re: Unique constaint violated without being violated  ("Merlin Moncure" <mmoncure@gmail.com>)
List 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.


pgsql-general by date:

Previous
From: "Merlin Moncure"
Date:
Subject: Re: visibility map - what do i miss?
Next
From: "Merlin Moncure"
Date:
Subject: Re: Unique constaint violated without being violated