Re: Test for cascade delete in plpgsql

From: Robert Fitzpatrick <robert(at)webtent(dot)org>
To: David Johnston <polobo(at)yahoo(dot)com>
Cc: 'PostgreSQL' <pgsql-general(at)postgresql(dot)org>
Subject: Re: Test for cascade delete in plpgsql
Date: 2011-10-14 12:57:17
Message-ID: 4E9831AD.6040402@webtent.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 10/13/2011 5:45 PM, David Johnston wrote:
> the company record should not be visible
> if you execute a SELECT against the companies table using the given
> company_id value. The previous is not tested and I am not totally sure
> about the visibility rules in this situation (mainly whether the cascade
> delete occurs before or after the statement delete)

Yes, you understood exactly what I am trying to do, and it appears the
cascade delete occurs after, I didn't even think of that. If I PERFORM a
query on the companies table to test if the record exists in the DELETE
AFTER trigger of the contacts table and base my restriction on IF FOUND,
the record is allowed to be deleted. Thanks!

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Guillaume Lelarge 2011-10-14 13:38:51 Re: [HACKERS] register creation date of table
Previous Message Willy-Bas Loos 2011-10-14 12:55:42 Re: [HACKERS] register creation date of table