From: Josh Berkus <josh@agliodbs.com>
To: Cedar Cox <cedarc@visionforisrael.com>
To: pgsql-sql@postgresql.org
Subject: Re: REFERENCES constraint
Date: Wed, 08 Aug 2001 09:29:17 -0700
Message-ID: <web-98845@davinci.ethosmedia.com> (raw)
In-Reply-To: <Pine.LNX.4.21.0108081850160.12272-100000@nanu.visionforisrael.com>
Cedar,
> 1. Can a column reference more than one table? (This assumes you use
> a
> single sequence to generate the IDs for both "tbla" and "tblb". I
> guess
> you would also have the problem of enforcing a unique index. Say
> what?!
> A unique index across multiple tables.. absurd :) eg..
>
> CREATE TABLE blah (
> id int4,
> f_id int4 REFERENCES tbla (id) REFERENCES tblb (id)
> )
I'd reccomend, instead, having blah reference tbla and tbla reference
tblb. It'd have the same effect, without forcing you to monkey around
with custom triggers.
> 2. Can a column reference another column in the same table? eg..
>
> CREATE TABLE bloo (
> id int4,
> p_id int4 REFERENCES bloo (id)
> -- or
> --p_id int4 REFERENCES (id)
> )
Er ... why would you want to?
-Josh Berkus
______AGLIO DATABASE SOLUTIONS___________________________
Josh Berkus
Complete information technology josh@agliodbs.com
and data management solutions (415) 565-7293
for law firms, small businesses fax 621-2533
and non-profit organizations. San Francisco
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 using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: josh@agliodbs.com, cedarc@visionforisrael.com
Subject: Re: REFERENCES constraint
In-Reply-To: <web-98845@davinci.ethosmedia.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