Thread: duplicate key violates unique constraint

duplicate key violates unique constraint

From
sweta@opspl.com
Date:
Hello all,

I have a table named "t_i_shift_shadow"  with following spec


     Column      |         Type          |
Modifiers
-----------------+-----------------------+-------------------------------------------------------------------
 cid             | character varying(20) | not null
 shift_rev_id    | character varying(20) | not null
 start_time      | bigint                | not null
 end_time        | bigint                | not null
 lunch_from_time | bigint                | default -1
 lunch_to_time   | bigint                | default -1
 shift_date      | date                  | not null
 is_cyclic       | integer               | not null
 serial          | integer               | not null default
nextval('t_i_shift_shadow_serial_seq'::regclass)
Indexes:
    "t_i_shift_shadow_pkey" PRIMARY KEY, btree (serial)
Triggers:
    _replcluster_logtrigger_4 AFTER INSERT OR DELETE OR UPDATE ON
t_i_shift_shadow FOR EACH ROW EXECUTE PROCEDURE
_replcluster.logtrigger('_replcluster', '4', 'vvvvvvvvk')


I am trying to replicate this table using slony.

But I get the following error... I wanted to know if this is a postgres
error ???  If it is what is causing it??

ERROR -->

 PGRES_FATAL_ERROR select "_replcluster".setAddTable(8, 36,
'public.t_i_shift_shadow', 't_i_shift_shadow_pkey', 'shift shadow
table');  - ERROR:  duplicate key violates unique constraint
"sl_table_tab_reloid_key"

I am a bit confused about where to post it.. So I am posting it here first...

Thanks and Regards,
Sweta.



Re: duplicate key violates unique constraint

From
Filip Rembiałkowski
Date:

2009/8/8 <sweta@opspl.com>
Hello all,

I have a table named "t_i_shift_shadow"  with following spec


    Column      |         Type          |
Modifiers
-----------------+-----------------------+-------------------------------------------------------------------
 cid             | character varying(20) | not null
 shift_rev_id    | character varying(20) | not null
 start_time      | bigint                | not null
 end_time        | bigint                | not null
 lunch_from_time | bigint                | default -1
 lunch_to_time   | bigint                | default -1
 shift_date      | date                  | not null
 is_cyclic       | integer               | not null
 serial          | integer               | not null default
nextval('t_i_shift_shadow_serial_seq'::regclass)
Indexes:
   "t_i_shift_shadow_pkey" PRIMARY KEY, btree (serial)
Triggers:
   _replcluster_logtrigger_4 AFTER INSERT OR DELETE OR UPDATE ON
t_i_shift_shadow FOR EACH ROW EXECUTE PROCEDURE
_replcluster.logtrigger('_replcluster', '4', 'vvvvvvvvk')


I am trying to replicate this table using slony.

But I get the following error... I wanted to know if this is a postgres
error ???  If it is what is causing it??

ERROR -->

 PGRES_FATAL_ERROR select "_replcluster".setAddTable(8, 36,
'public.t_i_shift_shadow', 't_i_shift_shadow_pkey', 'shift shadow
table');  - ERROR:  duplicate key violates unique constraint
"sl_table_tab_reloid_key"



Looks like you are trying to add a table with same ID second time.
Table ID has to be unique.

 

I am a bit confused about where to post it.. So I am posting it here first...


You can post such questions to slony1-general mailing list.



--
Filip Rembiałkowski
JID,mailto:filip.rembialkowski@gmail.com
http://filip.rembialkowski.net/