Re: DELETE trigger, direct or indirect?

Поиск
Список
Период
Сортировка
От Adrian Klaver
Тема Re: DELETE trigger, direct or indirect?
Дата
Msg-id c0b73262-1afc-842b-1653-1671a4f9e7a5@aklaver.com
обсуждение исходный текст
Ответ на DELETE trigger, direct or indirect?  (Dominique Devienne <ddevienne@gmail.com>)
Ответы Re: DELETE trigger, direct or indirect?  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-general
On 2/16/23 05:23, Dominique Devienne wrote:
> Hi. This is a bit unusual. We have a foreign key between two tables, 
> with ON DELETE CASCADE, to preserve referential integrity. But we 
> apparently also need to preserve the severed reference (by natural key, 
> i.e. its name), to later on reconnect the two entities after-the-fact, 
> should the parent row re-appear later on (in the same transaction or not 
> it still unclear).

This is going to need a more detailed description of the relationship 
between the two tables:

1) The actual FK relationship.

2) What "...preserve the severed reference (by natural key,  i.e. its 
name)" means?

3) What information will be used to reconnect the child rows to the 
parent rows?

> 
> To achieve this weird requirement, I'd like to know if it is possible in 
> an ON DELETE trigger to know whether the deletion is coming from a 
> direct-DELETE in the "child table", or whether the deletion is coming 
> from the "parent table" CASCADEd to the child table.
> 
> Thanks, --DD

-- 
Adrian Klaver
adrian.klaver@aklaver.com




В списке pgsql-general по дате отправления:

Предыдущее
От: Ron
Дата:
Сообщение: Re: Postgres undeterministically uses a bad plan, how to convince it otherwise?
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: DELETE trigger, direct or indirect?