From: wieck@debis.com
To: Greg Youngblood <YoungblG@houstoncellular.com>
Cc: 'PostgreSQL SQL List' <pgsql-sql@postgreSQL.org>
Subject: Re: [SQL] Rules, triggers, ??? - What is the best way to enforce data-valid ation tests??
Date: Thu, 27 Jan 2000 18:26:31 +0100 (CET)
Message-ID: <m12Dsgh-0003kGC@orion.SAPserv.Hamburg.dsh.de> (raw)
In-Reply-To: <2B9713A99045D211BB4E0008C7566869DC9F8C@scorpexc1.houstoncell.com>
> 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. You can 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 as the 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) #
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: wieck@debis.com, YoungblG@houstoncellular.com
Subject: Re: [SQL] Rules, triggers, ??? - What is the best way to enforce data-valid ation tests??
In-Reply-To: <m12Dsgh-0003kGC@orion.SAPserv.Hamburg.dsh.de>
References: <2B9713A99045D211BB4E0008C7566869DC9F8C@scorpexc1.houstoncell.com> <m12Dsgh-0003kGC@orion.SAPserv.Hamburg.dsh.de>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox