Обсуждение: Editing table properties drops all foreign keys and recreates them

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

Editing table properties drops all foreign keys and recreates them

От
Patrice Lefebvre
Дата:
When I open the properties on a table containing foreign key 
constraints, and then to go the SQL tab to see what will be executed, I 
notice all foreign keys are dropped and then recreated. For example when 
I open the table properties for the table zulook.inv_equipment on my 
database, the SQL pane reads as follow:

ALTER TABLE zulook.inv_equipment  DROP CONSTRAINT inv_equipment_company_entity_id_fkey;
ALTER TABLE zulook.inv_equipment  DROP CONSTRAINT inv_equipment_item_id_fkey;
ALTER TABLE zulook.inv_equipment  ADD CONSTRAINT inv_equipment_company_entity_id_fkey FOREIGN KEY 
(company_entity_id)      REFERENCES zulook.ab_company (company_entity_id) MATCH SIMPLE      ON UPDATE NO ACTION ON
DELETENO ACTION DEFERRABLE INITIALLY 
 
IMMEDIATE;
ALTER TABLE zulook.inv_equipment  ADD CONSTRAINT inv_equipment_item_id_fkey FOREIGN KEY (item_id)      REFERENCES
zulook.inv_item(item_id) MATCH SIMPLE      ON UPDATE NO ACTION ON DELETE NO ACTION DEFERRABLE INITIALLY 
 
IMMEDIATE;


I didn't have this behaviour problem under 1.12.x versions, I've noticed 
it starting with 1.14.x versions, and now it is still present in 1.16.0. 
I use pgAdmin 1.16.0 (Sep 7 2012, rev: REL-1_16_0, from binary) under 
Windows XP SP3, English version but on a Canadian French OS.



Re: Editing table properties drops all foreign keys and recreates them

От
Guillaume Lelarge
Дата:
On Fri, 2012-09-21 at 09:34 -0400, Patrice Lefebvre wrote:
> When I open the properties on a table containing foreign key 
> constraints, and then to go the SQL tab to see what will be executed, I 
> notice all foreign keys are dropped and then recreated. For example when 
> I open the table properties for the table zulook.inv_equipment on my 
> database, the SQL pane reads as follow:
> 
> ALTER TABLE zulook.inv_equipment
>    DROP CONSTRAINT inv_equipment_company_entity_id_fkey;
> ALTER TABLE zulook.inv_equipment
>    DROP CONSTRAINT inv_equipment_item_id_fkey;
> ALTER TABLE zulook.inv_equipment
>    ADD CONSTRAINT inv_equipment_company_entity_id_fkey FOREIGN KEY 
> (company_entity_id)
>        REFERENCES zulook.ab_company (company_entity_id) MATCH SIMPLE
>        ON UPDATE NO ACTION ON DELETE NO ACTION DEFERRABLE INITIALLY 
> IMMEDIATE;
> ALTER TABLE zulook.inv_equipment
>    ADD CONSTRAINT inv_equipment_item_id_fkey FOREIGN KEY (item_id)
>        REFERENCES zulook.inv_item (item_id) MATCH SIMPLE
>        ON UPDATE NO ACTION ON DELETE NO ACTION DEFERRABLE INITIALLY 
> IMMEDIATE;
> 
> 
> I didn't have this behaviour problem under 1.12.x versions, I've noticed 
> it starting with 1.14.x versions, and now it is still present in 1.16.0. 
> I use pgAdmin 1.16.0 (Sep 7 2012, rev: REL-1_16_0, from binary) under 
> Windows XP SP3, English version but on a Canadian French OS.
> 
> 

Yeah, I reproduce the issue. I added a ticket to work on this later.


-- 
Guillaume
http://blog.guillaume.lelarge.info
http://www.dalibo.com