Re: [SQL] Rules, triggers, ??? - What is the best way to enforce data-valid ation tests?? - Mailing list pgsql-sql

From wieck@debis.com (Jan Wieck)
Subject Re: [SQL] Rules, triggers, ??? - What is the best way to enforce data-valid ation tests??
Date
Msg-id m12Dsgh-0003kGC@orion.SAPserv.Hamburg.dsh.de
Whole thread Raw
In response to Rules, triggers, ??? - What is the best way to enforce data-valid ation tests?  (Greg Youngblood <YoungblG@houstoncellular.com>)
List pgsql-sql
> I am in the process of creating a large relational database. One of the key
> things I need to include in this database is a system to maintain data
> integrity across multiple tables.
>
> here's an example:
>
> [...]
>
> In the past I've tried triggers and rules and never did get them to work to
> my satisfaction. Either they would work for some tasks, but I couldn't adapt
> them to work in more complicated tables, or there were syntax problems and I
> never got them to work at all. If anyone can help, and provide some
> examples, i would greatly appreciate it.
>
> I currently have postgres 6.5.0 on the production server, and 6.5.1 or 6.5.2
> on my development boxes.
   Version  7.0 will have support for FOREIGN KEY syntax, that's   what you're looking for.
   I'm not sure if  ALTER  TABLE  ...  ADD  CONSTRAINT  will  be   implemented, but at least you can define all the
dependencies  during CREATE TABLE. The support not only includes the checks   about  key existance as in your example.
Youcan also specify   how the DB should behave if a referenced key from the primary   table  is  deleted  or  updated
(for example let references   automatically follow, do cascaded deletes  or  simply  reject   the modification as long
asthe PK is referenced).
 
   Get  a  snapshot  of the current development sources from our   CVS server using  anon-CVS.  Most  of  the
functionality is   already there.
 


Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#========================================= wieck@debis.com (Jan Wieck) #




pgsql-sql by date:

Previous
From: uihtot@myhome.net
Date:
Subject: 18 yr. old blonde 5963
Next
From: wieck@debis.com (Jan Wieck)
Date:
Subject: Re: [SQL] foreign key implementation