From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | terry(at)greatgulfhomes(dot)com |
Cc: | "'Jan Wieck'" <janwieck(at)yahoo(dot)com>, "'Achilleus Mantzios'" <achill(at)matrix(dot)gatewaynet(dot)com>, pgsql-general(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org |
Subject: | Re: [SQL] VIEWs and FOREIGN keys |
Date: | 2002-06-10 20:38:20 |
Message-ID: | 8541.1023741500@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-sql |
terry(at)greatgulfhomes(dot)com writes:
> I would just like to elaborate, and clarify if my understanding is correct:
> The implication of below is that you need a trigger in the foreign key
> target table on the DELETE event, so the foreign key table only lets you
> delete a row if there are no other tables refering to the key you want to
> delete.
> Views cannot have triggers, hence cannot have a DELETE trigger, therefore
> that is why the view cannot be a foreign key target table.
Got it in one.
One could perhaps imagine putting triggers on the table(s) that are
referenced by the view, but those triggers would have to do very slow
and expensive things to enforce the deletion constraint, at least in the
interesting cases where the view is a join, aggregation, GROUP BY, etc...
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Sullivan | 2002-06-10 20:40:29 | Re: Help with data transfer please |
Previous Message | Andrew Sullivan | 2002-06-10 20:37:27 | Re: logging to a file |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2002-06-10 21:07:56 | Re: Efficient DELETE Strategies |
Previous Message | Tom Lane | 2002-06-10 20:34:01 | Re: [HACKERS] Efficient DELETE Strategies |