Re: Referential integrity (foreign keys) across multiple tables

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Richard Jones <rich(at)annexia(dot)org>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Referential integrity (foreign keys) across multiple tables
Date: 2006-07-24 21:22:36
Message-ID: 20060724212236.GA14923@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Mon, Jul 24, 2006 at 18:53:20 +0100,
Richard Jones <rich(at)annexia(dot)org> wrote:
>
> I'm not sure what this means. By "data integrity" I just meant that I
> don't want applications to create page_contents.link_name fields which
> could point to non-existent URLs. (A URL consists of a particular
> hostid and url, since you're not allowed to have one host pointing to
> pages on another, and this is where the requirement for a foreign key
> which spans two tables comes from). Perhaps I meant "data
> consistency"? Anyway without some sort of check, be it a reference or
> a trigger -- assuming a trigger is possible -- then an application
> might create such a bad link.

I think part of the problem might have been over simplification of the
problem. In your example there was no reason to create that new column since
the information was available by doing a join between two tables and this
would prevent a problem with data being out of sync.

I see from another message in this thread that there is really more to
this example. It may be that you still don't need the new column, but I
haven't examined the new example carefully to say one way or the other.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Stephan Szabo 2006-07-24 22:04:47 Re: CREATE TABLE AS inside of a function
Previous Message Kevin Nikiforuk 2006-07-24 20:49:52 Re: CREATE TABLE AS inside of a function