Re: Reference to multiple cols

From: "Ville Jungman" <ville_jungman(at)hotmail(dot)com>
To: bruno(at)wolff(dot)to, josh(at)agliodbs(dot)com
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Reference to multiple cols
Date: 2003-01-12 13:06:03
Message-ID: F58VoEHsQy7sOujpP5x00002317@hotmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)wolff(dot)to>
>To: Josh Berkus <josh(at)agliodbs(dot)com>
>CC: Ville Jungman <ville_jungman(at)hotmail(dot)com>,pgsql-novice(at)postgresql(dot)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(at)agliodbs(dot)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(at)postgresql(dot)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

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Bruno Wolff III 2003-01-12 16:53:18 Re: Reference to multiple cols
Previous Message Rod Kreisler 2003-01-12 05:38:08 Re: ERROR: NEW used in non-rule query