Dear group, We are using postgresql 7.4.7 on Fedora Core 3. We are currently experiencing problems with running stored procedures on a database that contains about 1200 tables. We have a table named adm_inst_mas with the following structure Table "public.adm_inst_mas" Column | Type | Modifiers -----------+-----------------------+----------- inst_code | integer | not null inst_name | text | not null inst_abbr | character(3) | not null address | text | city | smallint | district | smallint | pincode | character varying(10) | Indexes: "adm_inst_mas_pkey" primary key, btree (inst_code) "inst_name_ukey" unique, btree (inst_name) "adm_inst_un" unique, btree (inst_abbr) Triggers: inst_order_trg AFTER INSERT ON adm_inst_mas FOR EACH ROW EXECUTE PROCEDURE inst_order_fun() We refer to the inst_code field as foreign key in almost 500 tables. At times when we set a foreign key constraint that refers the inst_code in adm_inst_mas the database detects deadlock. If we create the same constraint using alter table the constraint is set. Whenever such error occurs we have difficulties in getting stored procedures to run. Now no procedures are getting executed in the database. But table in which insert statement does not execute has no reference to the table adm_inst_mas. How shall we debug and correct this problem. We appreciate your early reply. Thanking You in advance Sathish Kumar.S -- Open WebMail Project (http://openwebmail.org) ---------------------------(end of broadcast)--------------------------- TIP 6: Have you searched our list archives? http://archives.postgresql.org