Search Postgresql Archives

Unique constaint violated without being violated

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.



-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux