From: | Richard Jones <rich(at)annexia(dot)org> |
---|---|
To: | Bruno Wolff III <bruno(at)wolff(dot)to>, pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Referential integrity (foreign keys) across multiple tables |
Date: | 2006-07-24 17:53:20 |
Message-ID: | 20060724175320.GA18434@furbychan.cocan.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On Mon, Jul 24, 2006 at 12:51:48PM -0500, Bruno Wolff III wrote:
> On Mon, Jul 24, 2006 at 09:59:07 +0100,
> Richard Jones <rich(at)annexia(dot)org> wrote:
> > On Sun, Jul 23, 2006 at 01:32:37PM -0500, Bruno Wolff III wrote:
> > > 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?
> >
> > Data integrity.
>
> This doesn't make sense in isolation. If that is all you are trying to do,
> then you don't need to do anything to the database design as the information
> is already there. The application just needs to do a join when querying the
> data.
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.
Rich.
--
Richard Jones, CTO Merjis Ltd.
Merjis - web marketing and technology - http://merjis.com
Team Notepad - intranets and extranets for business - http://team-notepad.com
From | Date | Subject | |
---|---|---|---|
Next Message | Richard Jones | 2006-07-24 17:57:51 | Re: Referential integrity (foreign keys) across multiple tables |
Previous Message | Bruno Wolff III | 2006-07-24 17:51:48 | Re: Referential integrity (foreign keys) across multiple tables |