Re: Avoiding cycles in a directed graph

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Avoiding cycles in a directed graph
Дата
Msg-id 14550.1268773752@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Avoiding cycles in a directed graph  (Tony Cebzanov <tonyceb@andrew.cmu.edu>)
Ответы Re: Avoiding cycles in a directed graph  (Richard Huxton <dev@archonet.com>)
Список pgsql-sql
Tony Cebzanov <tonyceb@andrew.cmu.edu> writes:
> I'm okay with running the big, fat WITH RECURSIVE query in my insert
> trigger if I have to -- it won't be great for performance, but I don't
> expect this to be a frequent operation, so I'll accept the performance
> hit if it works.

> Unfortunately I can't even get that working.  Here's the (not at all
> functional) trigger I've got right now, which only detects the cycle
> *after* it's been inserted, which is of no help at all.  Any way I can
> modify this to do the right thing?

Run it in an AFTER trigger?

If you don't expect this to be common, maybe you could fix the
concurrency issue by taking a table-wide lock that locks out
other writers.
        regards, tom lane


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

Предыдущее
От: Tony Cebzanov
Дата:
Сообщение: Re: Avoiding cycles in a directed graph
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: Avoiding cycles in a directed graph