Received: from mail1.waterford.org (mail1.waterford.org [205.124.117.6]) by postgresql.org (Postfix) with ESMTP id E379347591B for ; Thu, 28 Mar 2002 13:36:02 -0500 (EST) Received: from waterford.org ([205.124.138.93]) by mail1.waterford.org (Netscape Messaging Server 3.56) with ESMTP id 688 for ; Thu, 28 Mar 2002 11:24:01 -0700 Message-ID: <3CA3685F.47E2D497@waterford.org> Date: Thu, 28 Mar 2002 12:00:47 -0700 From: Oleg Lebedev X-Mailer: Mozilla 4.72 [en] (Windows NT 5.0; U) X-Accept-Language: en MIME-Version: 1.0 To: Postgres SQL Mailing List Subject: Table constraints Content-Type: text/plain; charset=koi8-r Content-Transfer-Encoding: 7bit X-Archive-Number: 200203/381 X-Sequence-Number: 7255 Hi everybody, I saw a couple of messages regarding rule/constraint/trigger standards which Tom proposed to adopt in postgres. I've read through the current specs, but still can't figure it out. I am using version 7.1.3 and this is what I am trying to do: I have 2 tables: Set { type_id int, set_desc varchar(128) } Type { id int primary key } I want to update a row in Type table and cascade this update to update Set table. I declare a constraint as follows: ALTER TABLE Set ADD CONSTRAINT fk_type FOREIGN KEY (type_id) REFERENCES Type (id) ON UPDATE CASCADE; Postgres gives me a NOTICE and creates the constraint. Here are some questions: Why pg_relcheck table is still empty after the constraint is added? Why instead it created 5 triggers (I checked pg_class.reltriggers for Set table): 3 called "fk_type" on Set and 2 unnamed on Type? Why when I try to update id in Type table I get RI violation error? Shouldn't it cascade the update? How can I drop the constraint now? I set reltriggers to 0 in pg_class entry corresponding to Set table, and tried to delete generated triggers, but since only 3 out of 5 have "fk_type" name, I couldn't figure out how to track down the rest of them. Thanks in advance for any help. Oleg