Skip site navigation (1) Skip section navigation (2)

BUG #2306: Duplicate primary key

From: "Andreas Jung" <lists(at)andreas-jung(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #2306: Duplicate primary key
Date: 2006-03-07 16:43:18
Message-ID: 20060307164318.3CFEEF0B04@svr2.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-bugs
The following bug has been logged online:

Bug reference:      2306
Logged by:          Andreas Jung
Email address:      lists(at)andreas-jung(dot)com
PostgreSQL version: 7.4.9
Operating system:   Linux
Description:        Duplicate primary key
Details: 

Ihave the following table (with 'id' as primary key:

Toolbox2Test=# \d hierarchy

                                             Table "public.hierarchy"

         Column          |            Type             |                    
    Modifiers

-------------------------+-----------------------------+----------------

-------------------------+-----------------------------+--------------------
-----------------------

 id                      | integer                     | not null default
nextval('public.hierarchy_id_seq'::text)

 parentid                | bigint                      |

 idprodukt               | bigint                      |

 bezeichnung             | character varying(160)      |

 neudat                  | timestamp without time zone |

 aedat                   | timestamp without time zone |

 benutzer                | character varying(32)       |

 pos                     | integer                     | default 0

 linkindex               | character varying(20)       |

 deleted                 | boolean                     | default false

 visible                 | boolean                     |

 sorting                 | boolean                     |

 comment                 | character varying(265)      |

 idhierarchy_share       | integer                     |

 show_gattung_in_bauplan | boolean                     | default false

 sortierung              | character varying(10)       |

Indexes:

    "hierarchy_pkey" PRIMARY KEY, btree (id)

    "hierarchy_deleted_idx" btree (deleted)

    "hierarchy_idhierarchy_share_idx" btree (idhierarchy_share)

    "hierarchy_idprodukt_idx" btree (idprodukt)



This gives me two rows with the same id=5077:

Toolbox2Test=# select * from hierarchy where id >= 5077 order by id;

  id   | parentid | idprodukt |                              bezeichnung    
                         |           neudat           |           aedat

     |     benutzer     | pos | linkindex | deleted | visible | sorting |   
          comment               | idhierarchy_share |
show_gattung_in_bauplan

| sortierung

-------+----------+-----------+---------------------------------------------
--------------------------+----------------------------+--------------------
---

-----+------------------+-----+-----------+---------+---------+---------+---
---------------------------------+-------------------+----------------------
---

+------------

  5077 |     4062 |           | Prsentieren                               
                          |                            | 2005-11-23
12:03:38.617

969 | RossmyU          |   1 | LI353323  | f       |         |         | CSV
import from test_tools.csv     |                   | f                      
|



  5077 |     4062 |           | Prsentation                               
                          |                            | 2005-11-24
15:43:50.756

414 | RossmyU          |   0 | LI353323  | t       |         |         | CSV
import from test_tools.csv     |                   | t                      
|



  5078 |     4062 |           | Rechner                                     
                         |                            | 2005-11-23
12:03:38.61

7969 | RossmyU          |   2 | LI353324  | f   

Search for all rows with id=5077 returns this:

Toolbox2Test=# select * from hierarchy where id = 5077;



  id  | parentid | idprodukt | bezeichnung  | neudat |           aedat      
     | benutzer | pos | linkindex | deleted | visible | sorting |           
comment             | idhierarchy_share | show_gattung_in_bauplan |
sortierung

------+----------+-----------+--------------+--------+----------------------
------+----------+-----+-----------+---------+---------+---------+----------
----------------------+-------------------+-------------------------+-------
-----

 5077 |     4062 |           | Prsentieren |        | 2005-11-23
12:03:38.617969 | RossmyU  |   1 | LI353323  | f       |         |         |
CSV import from test_tools.csv |                   | f                      
|

(1 row)


Any idea how to resolve this issue?

Responses

pgsql-bugs by date

Next:From: Giza KamilDate: 2006-03-08 10:27:20
Subject: BUG #2307: Buckup and sequences in DEFAULT part
Previous:From: H. GuijtDate: 2006-03-07 13:05:32
Subject: BUG #2305: "No bufferspace available" error on large insert

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group