Bug 17544 double attribute

This commit is contained in:
sparkyx 2006-08-27 16:00:31 +00:00
parent 56b3ab7332
commit fb3fb31a7d

View file

@ -1,4 +1,5 @@
begin;
create or replace function correct_sequence ( p_sequence text,p_col text, p_table text )
returns integer
as
@ -46,6 +47,19 @@ comment on function correct_sequence (text,text,text) is ' Often the primary key
select correct_sequence('s_jnt_fic_att_value','jft_id','jnt_fic_att_value');
-- add a pk to the table jnt_fic_attr
alter table jnt_fic_attr add jnt_id int8;
create sequence s_jnt_id;
alter table jnt_fic_attr alter jnt_id set default nextval('s_jnt_id');
update jnt_fic_attr set jnt_id=nextval('s_jnt_id');
alter table jnt_fic_attr add constraint pk_jnt_fic_attr primary key (jnt_id);
-- remove duplicate attr
delete from jnt_fic_attr where jnt_id in ( select a.jnt_id from jnt_fic_attr a join jnt_fic_attr b on (a.fd_id=b.fd_id and a.ad_id=b.ad_id) where a.jnt_id > b.jnt_id);
commit;