Re: Enforcing Join condition

From: "Albe Laurenz" <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: சிவகுமார் மா *EXTERN* <masivakumar(at)gmail(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Enforcing Join condition
Date: 2007-11-15 14:31:08
Message-ID: D960CB61B694CF459DCFB4B0128514C28E331A@exadv11.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

சிவகுமார் மா wrote:
>> You want to have a "conditional" foreign key reference that checks
>> against different tables depending on a "type" field, right?
>>
>> For complicated conditions like this, you could use a
>> BEFORE INSERT trigger that throws an error when the condition
>> is violated.
>
> That we do. My query is to put a check on select queries to avoid
> programmers not using all the necessary conditions.

You can create a view that does the join the correct way
(maybe a UNION of two different joins) and give the programmers
access to that view, but not to the underlying tables.

Yours,
Laurenz Albe

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Andrew Sullivan 2007-11-15 14:35:47 Re: PLpgsql debugger question
Previous Message Lew 2007-11-15 14:20:42 Re: Query Performance Test