Thread: BUG #8610: Duplicate records with same PK value

BUG #8610: Duplicate records with same PK value

From
nhajek@meridian-technical.com
Date:
The following bug has been logged on the website:

Bug reference:      8610
Logged by:          Nick Hajek
Email address:      nhajek@meridian-technical.com
PostgreSQL version: 9.3.1
Operating system:   Windows 7 x64
Description:

Updating a record with a primary key resulted in 2 records in the table with
the same primary key.  I'm able to view both using a number of pg manager
application and a select for the single pk value of interest returns 2
records.

Re: BUG #8610: Duplicate records with same PK value

From
Michael Paquier
Date:
On Wed, Nov 20, 2013 at 12:07 PM,  <nhajek@meridian-technical.com> wrote:
> The following bug has been logged on the website:
>
> Bug reference:      8610
> Logged by:          Nick Hajek
> Email address:      nhajek@meridian-technical.com
> PostgreSQL version: 9.3.1
> Operating system:   Windows 7 x64
> Description:
>
> Updating a record with a primary key resulted in 2 records in the table with
> the same primary key.  I'm able to view both using a number of pg manager
> application and a select for the single pk value of interest returns 2
> records.
Could you provide a self-contained test case? A check on the primary
key constraint is done when changing such tuples like in the following
case:
=# create table aa (a int primary key);
CREATE TABLE
=# insert into aa values (1),(2);
INSERT 0 2
=# update aa set a = 1 where a = 2;
ERROR:  23505: duplicate key value violates unique constraint "aa_pkey"
DETAIL:  Key (a)=(1) already exists.
SCHEMA NAME:  public
TABLE NAME:  aa
CONSTRAINT NAME:  aa_pkey
LOCATION:  _bt_check_unique, nbtinsert.c:398
Regards,
--
Michael