From: Jose' Soares Da Silva <sferac@bo.nettuno.it>
To: Mike Lemler <coronach@datacruz.com>
Cc: pgsql-sql@postgreSQL.org
Subject: Re: Referential Integrity
Date: Thu, 14 May 1998 10:57:09 +0000 (UTC)
Message-ID: <Pine.LNX.3.96.980514105428.527A-100000@proxy.bazzanese.com> (raw)
In-Reply-To: <3.0.5.32.19980513152842.007a37a0@datacruz.com>
On Wed, 13 May 1998, Mike Lemler wrote:
> I haven't been able to find documentation on how to implement referential
> integrity between tables with postgres via sql. Could someone please post
> an example. Thanks.
>
> Michael.
>
Table Constraint definition:
[ CONSTRAINT name ]
{ PRIMARY KEY constraint |
UNIQUE constraint |
CHECK constraint }
Column Constraint definition:
[ CONSTRAINT name ]
{ NOT NULL constraint |
PRIMARY KEY constraint |
UNIQUE constraint |
CHECK constraint }
examples:
--defines a CHECK column constraint:
--
CREATE TABLE distributors (
did DECIMAL(3) CHECK (did > 100),
name VARCHAR(40)
);
--defines a CHECK table constraint:
--
CREATE TABLE distributors (
did DECIMAL(3),
name VARCHAR(40)
CONSTRAINT con1 CHECK (did > 100 AND name > '')
);
PS: FOREIGN KEY is not implemented yet you can use TRIGGERS instead
take a look at ...contrib/refint*
Jose'
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: sferac@bo.nettuno.it, coronach@datacruz.com
Subject: Re: Referential Integrity
In-Reply-To: <Pine.LNX.3.96.980514105428.527A-100000@proxy.bazzanese.com>
References: <3.0.5.32.19980513152842.007a37a0@datacruz.com> <Pine.LNX.3.96.980514105428.527A-100000@proxy.bazzanese.com>
* 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