Re: Reference to multiple cols - Mailing list pgsql-novice

From Ville Jungman
Subject Re: Reference to multiple cols
Date
Msg-id F58VoEHsQy7sOujpP5x00002317@hotmail.com
Whole thread Raw
In response to Reference to multiple cols  ("Ville Jungman" <ville_jungman@hotmail.com>)
Responses Re: Reference to multiple cols  (Bruno Wolff III <bruno@wolff.to>)
Re: Reference to multiple cols  (Lex Berezhny <LBerezhny@DevIS.com>)
List pgsql-novice
Thank You for help!

Still i have one problem left. How can i determine which table's row
references to the main table row if i don't want to read every referencing
table and search the right row. That was a part of the original problem and
idea why i first wanted that the main table had the column that references
to other tables.

ville jungman, ulvilantie 3 b 11, 00350 helsinki, finland
tel. + 358 - 9 - 225 4482 , http://www.kolumbus.fi/vilmak
usko Herraan Jeesukseen, niin sin� pelastut. (apt. 16:31)


>From: Bruno Wolff III <bruno@wolff.to>
>To: Josh Berkus <josh@agliodbs.com>
>CC: Ville Jungman <ville_jungman@hotmail.com>,pgsql-novice@postgresql.org
>Subject: Re: [NOVICE] Reference to multiple cols
>Date: Sat, 11 Jan 2003 18:51:21 -0600
>
>On Sat, Jan 11, 2003 at 14:00:14 -0800,
>   Josh Berkus <josh@agliodbs.com> wrote:
> >
> > This should give you a system in which animal_id is the primary key for
> > each table, and therefore there is a one-for-one relationship between
> > the animal table and each of the dog and cat tables, and would prevent
> > you from deleting a referenced record from the animal table.
> >
> > You would need an additional trigger to prevent duplication *between*
> > the dog and cat tables.
>
>There is a way to do this without triggers. You add an animal type
>field to all of the tables. The foreign keys then should use both animal id
>and animal type (which means you need to make animal_id and animal_type
>a combined unique key on the animal table). You add a constraint to the
>animal
>specific tables forcing the animal type to be the appropiate type.
>
>---------------------------(end of broadcast)---------------------------
>TIP 3: if posting/reading through Usenet, please send an appropriate
>subscribe-nomail command to majordomo@postgresql.org so that your
>message can get through to the mailing list cleanly


_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963


pgsql-novice by date:

Previous
From: "Rod Kreisler"
Date:
Subject: Re: ERROR: NEW used in non-rule query
Next
From: Bruno Wolff III
Date:
Subject: Re: Reference to multiple cols