pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Chris Czeyka <czeyka@skwea.co.jp>
To: Kirby C. Bohling <kbohling@birddog.com>
Cc: Martijn van Oosterhout <kleptog@svana.org>
Cc: pgsql-sql@postgresql.org
Subject: Re: two tables - foreign keys referring to each other...
Date: Wed, 21 Feb 2001 14:09:49 +0900
Message-ID: <3A934D9D.1019C0EA@skwea.co.jp> (raw)
References: <3A93366B.DC0B83F4@skwea.co.jp>
	<3A93487B.DDFA4F53@birddog.com>

ThX Kirby, ThX Martijn,

as you can see I'm new to the SQL- and database world.
My policy for this project is to FORCE an admin to be in an institute. If one
admin behaves bad for the database project the institute is responsible for
her/him. This institute would be represented by a special admin (therefore the
link back).

Anyway, I see that crosslinking is really a little bit tricky...
I will do this check in the application level (Java) and see, if this is easier
and even necessary. For now I might use only admin(fk)->institute. This is
necessary to trace back responsibility.

as beginner I appreciate good hints,

cheers,
Chris

> 
>         IMHO, you should consider not having the admin table have a link to the
> institute table.  If you want to find the institute a particular admin
> is connected with, find that look in the institutes table.  The astute
> reader will note the advice is symmetric, you can not have a link from
> the institute to the admin.  If you don't want to have dangling admin's
> you might be able to get a trigger/stored procedure to do it for you
> (Note:I done triggers in Oracle, never in PostGres so take that with a
> grain of salt.  I would be shocked if you couldn't do it with a Trigger
> under PostGres.  I believe it us commonly done with long objects as a
> matter of fact).
> 
>         Do what you like, and I hope this helps.
> 
>                 Kirby
>



view thread (8+ messages)  latest in thread

Message-ID: <3A934D9D.1019C0EA@skwea.co.jp>
Permalink:  ../3A934D9D.1019C0EA@skwea.co.jp/
Also on:    postgresql.org/message-id/3A934D9D.1019C0EA@skwea.co.jp

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: czeyka@skwea.co.jp, kbohling@birddog.com, kleptog@svana.org
  Subject: Re: two tables - foreign keys referring to each other...
  In-Reply-To: <3A934D9D.1019C0EA@skwea.co.jp>
  References: <3A93366B.DC0B83F4@skwea.co.jp> <3A93487B.DDFA4F53@birddog.com> <3A934D9D.1019C0EA@skwea.co.jp>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox