Обсуждение: Duplicate records in a table inspite of a primary key

Поиск
Список
Период
Сортировка

Duplicate records in a table inspite of a primary key

От
subamathy
Дата:
 Hi,
We are having problems resulting from users being able to create duplicate records
in table.
 
body { margin: 0 0 0 0; padding:0 0 0 0 } td,div { font-family:Tahoma;font-size:8pt;vertical-align:top } body { margin: 0 0 0 0; padding:0 0 0 0 } .transcript { background-color:#d2d2d2; } .messageBlock { margin-left:4px; margin-bottom:3px } .message { margin-left:100px; word-wrap:break-word; white-space:-moz-pre-wrap; _white-space:pre; } .messageCont { margin-left:100px; word-wrap:break-word; white-space:-moz-pre-wrap; _white-space:pre;} .other { color:#39577a;vertical-align:top;font-weight:bold;font-style:normal;float:left; width:95px; } .myself { color:#da8103;font-style:normal;font-weight:bold;font-style:normal;float:left; width:95px; } .otherCont { font-size:8px;text-align:right; color:#39577a;font-family:Arial,Lucida Grande;font-style:normal;vertical-align:top;font-weight:bold;float:left; width:95px; } .myselfCont { font-size:8px;text-align:right; color:#da8103;font-family:Arial,Lucida Grande;font-style:normal;vertical-align:top;font-weight:bold;float:left; width:95px; } .system { margin-left:4px; word-wrap:break-word;color:#da8103;font-style:normal;font-weight:normal; white-space:-moz-pre-wrap; _white-space:pre; } .showTimestamp { margin-right:3px; float:right; color:#999999;font-style:normal;font-weight:normal; } .other1 { color:#ac2000;vertical-align:top;font-weight:bold;font-style:normal;float:left; width:95px; } .otherCont1 { font-size:8px;text-align:right; color:#ac2000;font-family:Arial,Lucida Grande;font-style:normal;vertical-align:top;font-weight:bold;float:left; width:95px; } .other2 { color:#3c9fa8;vertical-align:top;font-weight:bold;font-style:normal;float:left; width:95px; } .otherCont2 { font-size:8px;text-align:right; color:#3c9fa8;font-family:Arial,Lucida Grande;font-style:normal;vertical-align:top;font-weight:bold;float:left; width:95px; } .other3 { color:#e25614;vertical-align:top;font-weight:bold;font-style:normal;float:left; width:95px; } .otherCont3 { font-size:8px;text-align:right; color:#e25614;font-family:Arial,Lucida Grande;font-style:normal;vertical-align:top;font-weight:bold;float:left; width:95px; } .other4 { color:#0b6ac8;vertical-align:top;font-weight:bold;font-style:normal;float:left; width:95px; } .otherCont4 { font-size:8px;text-align:right; color:#0b6ac8;font-family:Arial,Lucida Grande;font-style:normal;vertical-align:top;font-weight:bold;float:left; width:95px; } .other5 { color:#b23290;vertical-align:top;font-weight:bold;font-style:normal;float:left; width:95px; } .otherCont5 { font-size:8px;text-align:right; color:#b23290;font-family:Arial,Lucida Grande;font-style:normal;vertical-align:top;font-weight:bold;float:left; width:95px; } .other6 { color:#02e7c7;vertical-align:top;font-weight:bold;font-style:normal;float:left; width:95px; } .otherCont6 { font-size:8px;text-align:right; color:#02e7c7;font-family:Arial,Lucida Grande;font-style:normal;vertical-align:top;font-weight:bold;float:left; width:95px; } .other7 { color:#5b3284;vertical-align:top;font-weight:bold;font-style:normal;float:left; width:95px; } .otherCont7 { font-size:8px;text-align:right; color:#5b3284;font-family:Arial,Lucida Grande;font-style:normal;vertical-align:top;font-weight:bold;float:left; width:95px; } .tsDisplay { display:block }  Below is the description of the table
Column | Type | Modifiers
-----------------------+------------------------+-----------
user_id | character varying(128) | not null
person_email_required | numeric(5,0) |
wddx_data | text |
proxy_id | character varying(128) |
email_to | character varying(6) |
password | character varying(60) |
user_name | character varying(64) |
language_preference | character varying(20) |
enable_autosearch | character varying(6) |
country_id | character varying(16) |
Indexes:
"i_personalise" PRIMARY KEY, btree (user_id)
"i_personalise_proxy_id" btree (proxy_id)
"i_personalise_user_id" btree (user_id)
 
body { margin: 0 0 0 0; padding:0 0 0 0 } td,div { font-family:Tahoma;font-size:8pt;vertical-align:top } body { margin: 0 0 0 0; padding:0 0 0 0 } .transcript { background-color:#d2d2d2; } .messageBlock { margin-left:4px; margin-bottom:3px } .message { margin-left:100px; word-wrap:break-word; white-space:-moz-pre-wrap; _white-space:pre; } .messageCont { margin-left:100px; word-wrap:break-word; white-space:-moz-pre-wrap; _white-space:pre;} .other { color:#39577a;vertical-align:top;font-weight:bold;font-style:normal;float:left; width:95px; } .myself { color:#da8103;font-style:normal;font-weight:bold;font-style:normal;float:left; width:95px; } .otherCont { font-size:8px;text-align:right; color:#39577a;font-family:Arial,Lucida Grande;font-style:normal;vertical-align:top;font-weight:bold;float:left; width:95px; } .myselfCont { font-size:8px;text-align:right; color:#da8103;font-family:Arial,Lucida Grande;font-style:normal;vertical-align:top;font-weight:bold;float:left; width:95px; } .system { margin-left:4px; word-wrap:break-word;color:#da8103;font-style:normal;font-weight:normal; white-space:-moz-pre-wrap; _white-space:pre; } .showTimestamp { margin-right:3px; float:right; color:#999999;font-style:normal;font-weight:normal; } .other1 { color:#ac2000;vertical-align:top;font-weight:bold;font-style:normal;float:left; width:95px; } .otherCont1 { font-size:8px;text-align:right; color:#ac2000;font-family:Arial,Lucida Grande;font-style:normal;vertical-align:top;font-weight:bold;float:left; width:95px; } .other2 { color:#3c9fa8;vertical-align:top;font-weight:bold;font-style:normal;float:left; width:95px; } .otherCont2 { font-size:8px;text-align:right; color:#3c9fa8;font-family:Arial,Lucida Grande;font-style:normal;vertical-align:top;font-weight:bold;float:left; width:95px; } .other3 { color:#e25614;vertical-align:top;font-weight:bold;font-style:normal;float:left; width:95px; } .otherCont3 { font-size:8px;text-align:right; color:#e25614;font-family:Arial,Lucida Grande;font-style:normal;vertical-align:top;font-weight:bold;float:left; width:95px; } .other4 { color:#0b6ac8;vertical-align:top;font-weight:bold;font-style:normal;float:left; width:95px; } .otherCont4 { font-size:8px;text-align:right; color:#0b6ac8;font-family:Arial,Lucida Grande;font-style:normal;vertical-align:top;font-weight:bold;float:left; width:95px; } .other5 { color:#b23290;vertical-align:top;font-weight:bold;font-style:normal;float:left; width:95px; } .otherCont5 { font-size:8px;text-align:right; color:#b23290;font-family:Arial,Lucida Grande;font-style:normal;vertical-align:top;font-weight:bold;float:left; width:95px; } .other6 { color:#02e7c7;vertical-align:top;font-weight:bold;font-style:normal;float:left; width:95px; } .otherCont6 { font-size:8px;text-align:right; color:#02e7c7;font-family:Arial,Lucida Grande;font-style:normal;vertical-align:top;font-weight:bold;float:left; width:95px; } .other7 { color:#5b3284;vertical-align:top;font-weight:bold;font-style:normal;float:left; width:95px; } .otherCont7 { font-size:8px;text-align:right; color:#5b3284;font-family:Arial,Lucida Grande;font-style:normal;vertical-align:top;font-weight:bold;float:left; width:95px; } .tsDisplay { display:block }  

database version: PostgreSQL 8.0.1

i_personalise- index

conn type: Primary (constriant Type)
condeferrable: False
conkey: 1 (column which has constraint) 

 
 
Could you please help me out in finding the reason for such dupicate records existing

Could you pls help me out in finding the reson for duplicate records being inserted.

Re: Duplicate records in a table inspite of a primary key

От
"Rafael Domiciano"
Дата:
Did you verified if isn't the software that is doing this?

2008/8/12 subamathy <subamathy@gmail.com>
 Hi,
We are having problems resulting from users being able to create duplicate records
in table.
 
 Below is the description of the table
Column | Type | Modifiers
-----------------------+------------------------+-----------
user_id | character varying(128) | not null
person_email_required | numeric(5,0) |
wddx_data | text |
proxy_id | character varying(128) |
email_to | character varying(6) |
password | character varying(60) |
user_name | character varying(64) |
language_preference | character varying(20) |
enable_autosearch | character varying(6) |
country_id | character varying(16) |
Indexes:
"i_personalise" PRIMARY KEY, btree (user_id)
"i_personalise_proxy_id" btree (proxy_id)
"i_personalise_user_id" btree (user_id)
 
 

database version: PostgreSQL 8.0.1

i_personalise- index

conn type: Primary (constriant Type)
condeferrable: False
conkey: 1 (column which has constraint) 

 
Could you please help me out in finding the reason for such dupicate records existing
 

Could you pls help me out in finding the reson for duplicate records being inserted.


Re: Duplicate records in a table inspite of a primary key

От
Julius Tuskenis
Дата:
Hello,

please send a sql script that was used to create this table. If you use
pgAdmin you can copy the sql from it. By saying dublicate records you
mean identical? That is there are records with the same user_id value?

subamathy rašė:
>  Hi,
> We are having problems resulting from users being able to create
> duplicate records
> in table.
>
>  Below is the description of the table
>
> Column | Type | Modifiers
> -----------------------+------------------------+-----------
> user_id | character varying(128) | not null
> person_email_required | numeric(5,0) |
> wddx_data | text |
> proxy_id | character varying(128) |
> email_to | character varying(6) |
> password | character varying(60) |
> user_name | character varying(64) |
> language_preference | character varying(20) |
> enable_autosearch | character varying(6) |
> country_id | character varying(16) |
> Indexes:
> "i_personalise" PRIMARY KEY, btree (user_id)
> "i_personalise_proxy_id" btree (proxy_id)
> "i_personalise_user_id" btree (user_id)
>
>
>
>
> database version: PostgreSQL 8.0.1
>
> i_personalise- index
>
> conn type: Primary (constriant Type)
> condeferrable: False
> conkey: 1 (column which has constraint)
>
>
> Could you please help me out in finding the reason for such dupicate
> records existing
>
>
> Could you pls help me out in finding the reson for duplicate records
> being inserted.
>


--
Julius Tuskenis
Programavimo skyriaus vadovas
UAB nSoft
mob. +37068233050


Re: Duplicate records in a table inspite of a primary key

От
Robert Treat
Дата:
On Tuesday 12 August 2008 02:47:58 subamathy wrote:
>  Hi,
>  We are having problems resulting from users being able to create duplicate
> records
> in table.
>
>   Below is the description of the table
>  Column | Type | Modifiers
> -----------------------+------------------------+-----------
> user_id | character varying(128) | not null
> person_email_required | numeric(5,0) |
> wddx_data | text |
> proxy_id | character varying(128) |
> email_to | character varying(6) |
> password | character varying(60) |
> user_name | character varying(64) |
> language_preference | character varying(20) |
> enable_autosearch | character varying(6) |
> country_id | character varying(16) |
> Indexes:
> "i_personalise" PRIMARY KEY, btree (user_id)
> "i_personalise_proxy_id" btree (proxy_id)
> "i_personalise_user_id" btree (user_id)
>
>
> database version: PostgreSQL 8.0.1
>
> i_personalise- index
>
> conn type: Primary (constriant Type)
> condeferrable: False
> conkey: 1 (column which has constraint)
>
> Could you please help me out in finding the reason for such dupicate
> records existing
>
>
> Could you pls help me out in finding the reson for duplicate records being
> inserted.

I'm pretty sure that between 8.0.1 and 8.0.17 there are a couple of bugfixes
related to duplicate rows with pk scenarios, you should probably take some
time to upgrade before you spend too much time digging into this (make sure
to read all of the release notes for those versions in between, i'm also
thinking there are some special instructions that might need to be done
somewhere in there)

--
Robert Treat
Build A Brighter LAMP :: Linux Apache {middleware} PostgreSQL

Re: Duplicate records in a table inspite of a primary key

От
Rex Mabry
Дата:
You have to be careful when using characters as your PK.  A trailing space could give the appearance of duplicate keys.
Example:
"user1"
"user1 " (This one has a space at the end)

--- On Tue, 8/12/08, Robert Treat <xzilla@users.sourceforge.net> wrote:
From: Robert Treat <xzilla@users.sourceforge.net>
Subject: Re: [ADMIN] Duplicate records in a table inspite of a primary key
To: pgsql-admin@postgresql.org
Cc: "subamathy" <subamathy@gmail.com>
Date: Tuesday, August 12, 2008, 9:27 AM

On Tuesday 12 August 2008 02:47:58 subamathy wrote:
>  Hi,
>  We are having problems resulting from users being able to create
duplicate
> records
> in table.
>
>   Below is the description of the table
>  Column | Type | Modifiers
> -----------------------+------------------------+-----------
> user_id | character varying(128) | not null
> person_email_required | numeric(5,0) |
> wddx_data | text |
> proxy_id | character varying(128) |
> email_to | character varying(6) |
> password | character varying(60) |
> user_name | character varying(64) |
> language_preference | character varying(20) |
> enable_autosearch | character varying(6) |
> country_id | character varying(16) |
> Indexes:
> "i_personalise" PRIMARY KEY, btree (user_id)
> "i_personalise_proxy_id" btree (proxy_id)
> "i_personalise_user_id" btree (user_id)
>
>
> database version: PostgreSQL 8.0.1
>
> i_personalise- index
>
> conn type: Primary (constriant Type)
> condeferrable: False
> conkey: 1 (column which has constraint)
>
> Could you please help me out in finding the reason for such dupicate
> records existing
>
>
> Could you pls help me out in finding the reson for duplicate records being
> inserted.

I'm pretty sure that between 8.0.1 and 8.0.17 there are a couple of
bugfixes 
related to duplicate rows with pk scenarios, you should probably take some 
time to upgrade before you spend too much time digging into this (make sure 
to read all of the release notes for those versions in between, i'm also 
thinking there are some special instructions that might need to be done 
somewhere in there)

-- 
Robert Treat
Build A Brighter LAMP :: Linux Apache {middleware} PostgreSQL

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