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-23 18:32:37
Message-ID: 20060723183237.GA22586@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Sat, Jul 22, 2006 at 14:32:57 +0100,
Richard Jones <rich(at)annexia(dot)org> wrote:
>
> Now I want to add a column to page_contents, say called link_name,
> which is going to reference the pages.url column for the particular
> host that this page belongs to.

What are you trying to accomplish by this? The information is available
by doing a join. If you are trying to simplify things for applications,
you can probably do it with a view or rules depending on whether you
want to have an updatable view. If you are denormalizing for performance
and want constraints to maintain consistancy, then you probably want
to push the hostid down to page_contents as well as the url. These could
both be set with a trigger. (I think a rule could be used as well.)

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Richard Jones 2006-07-24 08:59:07 Re: Referential integrity (foreign keys) across multiple tables
Previous Message Alvaro Herrera 2006-07-23 16:10:51 Re: Rows with exclusive lock