Re: FK pointing to a VIEW

From: "Merlin Moncure" <mmoncure(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: FK pointing to a VIEW
Date: 2006-11-10 19:31:43
Message-ID: b42b73150611101131q642e8429s30aa12c054072733@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 11/10/06, Sandro Dentella <sandro(at)e-den(dot)it> wrote:
> Do I understad correctly that i cannot point a Foreign Key to a view? Which
> is the rationale of this?

Blame the sql standard. Foreign keys are required to reference a
table with a unique constraint, and you can't add a unique constraint
to a view. While I agree in principle that such a thing should be
able to be done, it simply isn't possible. (in PostgreSQL, you can't
even add an index to a view, which a unique constraint would depend
on).

merlin

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Brendan Jurd 2006-11-10 19:34:36 Request for replication advice
Previous Message Sandro Dentella 2006-11-10 19:16:11 FK pointing to a VIEW