Thread: BUG #1202: Primary Key constraint not respected

BUG #1202: Primary Key constraint not respected

From
"PostgreSQL Bugs List"
Date:
The following bug has been logged online:

Bug reference:      1202
Logged by:          Enrico

Email address:      carrara@pd.infn.it

PostgreSQL version: 7.4

Operating system:   linux Debian Sarge

Description:        Primary Key constraint not respected

Details:

Hi, I'm using version 7.4.2.
I created this table (italian text, sorry):

prova=> \d crate
          Tabella "public.crate"
 Colonna  |  Tipo   |    Modificatori
----------+---------+---------------------
 code     | integer | not null
 location | integer | default 1
 capacity | integer | not null default 70
Indici:
    "code" chiave primaria, btree (code)

("code" is primay key, without oids)

I entered twice the same "code" and I got no error, as you can see:

prova=> select * from crate where code > 500;
 code | location | capacity
------+----------+----------
  503 |        1 |       48
  503 |        1 |       48
  501 |        1 |        1
  502 |        1 |        1
  504 |        1 |       48
(5 righe)

It happened only once, now it correctly says:

prova=> insert into crate (code) values (503);
ERROR:  duplicate key violates unique constraint "code"

Thanks.
-E-nrico