X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E83BBD1B257 for ; Wed, 4 Aug 2004 11:50:11 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 61590-01 for ; Wed, 4 Aug 2004 14:50:12 +0000 (GMT) Received: from cms.mail.virginia.edu (fork0.mail.Virginia.EDU [128.143.2.190]) by svr1.postgresql.org (Postfix) with ESMTP id 23EF9D1B1CD for ; Wed, 4 Aug 2004 11:49:57 -0300 (ADT) Received: from virginia.edu (d-137-133-131.bootp.Virginia.EDU [137.54.133.131]) by cms.mail.virginia.edu (Postfix) with ESMTP id 75F9E1682FA for ; Wed, 4 Aug 2004 10:50:06 -0400 (EDT) Message-ID: <4110F79A.2030002@virginia.edu> Date: Wed, 04 Aug 2004 10:50:02 -0400 From: Jodi Kanter User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Postgres Admin List Subject: check constraints Content-Type: multipart/alternative; boundary="------------070101030409030408040504" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.4 tagged_above=0.0 required=5.0 tests=HTML_30_40, HTML_MESSAGE, HTML_TITLE_EMPTY X-Spam-Level: * X-Archive-Number: 200408/18 X-Sequence-Number: 14413 This is a multi-part message in MIME format. --------------070101030409030408040504 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit I have little experience with postgres' check constraint features and was hoping to get some guidance. We have a table which houses links to various user files. The PK of this table is fi_pk. There are several tables in which a foreign key (fi_fk) to this field exist. We are implementing a feature which will allow users to remove old files from their repositories. It would be nice to have a check that goes out to all tables that have this fi_fk field and checks to see if the fi_pk for their particular record exists and would then not allow the deletion if a link occurs somewhere. I realize that I can do this with specific SQL in the code but was wondering if it's possible to implement a sort of general database wide check of this nature. That way if future tables are added with this FK field then the code would not have to be altered. Thanks. Jodi Kanter -- _______________________________ Jodi L Kanter BioInformatics Database Administrator University of Virginia (434) 924-2846 jkanter@virginia.edu --------------070101030409030408040504 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit I have little experience with postgres' check constraint features and was hoping to get some guidance. We have a table which houses links to various user files. The PK of this table is fi_pk. There are several tables in which a foreign key (fi_fk) to this field exist. We are implementing a feature which will allow users to remove old files from their repositories. It would be nice to have a check that goes out to all tables that have this fi_fk field and checks to see if the fi_pk for their particular record exists and would then not allow the deletion if a link occurs somewhere.
I realize that I can do this with specific SQL in the code but was wondering if it's possible to implement a sort of general database wide check of this nature. That way if future tables are added with this FK field then the code would not have to be altered.
Thanks.
Jodi Kanter
--
_______________________________

_______________________________
Jodi L Kanter
BioInformatics Database Administrator
University of Virginia
(434) 924-2846
jkanter@virginia.edu

 

--------------070101030409030408040504--