Re: Check constraints and function volatility categories

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: Check constraints and function volatility categories
Дата
Msg-id CAKFQuwarkqAXcAU68=iNtBfvLKjh=uZZ+U9+YHimVdeujdGotQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Check constraints and function volatility categories  (Adrian Klaver <adrian.klaver@aklaver.com>)
Ответы Re: Check constraints and function volatility categories  (Adrian Klaver <adrian.klaver@aklaver.com>)
Список pgsql-general
On Mon, Feb 1, 2016 at 2:11 PM, Adrian Klaver <adrian.klaver@aklaver.com> wrote:
On 02/01/2016 12:52 PM, Dane Foster wrote:
On Mon, Feb 1, 2016 at 3:41 PM, Adrian Klaver <adrian.klaver@aklaver.com
<mailto:adrian.klaver@aklaver.com>> wrote:



    As an example of where this leads see:

    http://www.postgresql.org/message-id/7224.1452275604@sss.pgh.pa.us

​Thanks for the heads up. The good news is all machine access to the
data will be via functions and views so I can inline the constraint in
the right places. In other news, this sucks! I have no idea what it

I could see moving your constraint into a per row trigger.

You'd need to basically replicate the current FK constraint setup but with custom queries...you need the insert/update trigger on the main table and then a insert/update/delete trigger on the referenced table to ensure that actions just rejected if the relevant detail on the main table isn't changed.  Then decide whether you need something like "ON UPDATE/DELETE CASCADE" instead of the default 'reject' behavior.

I take it you would need to ensure that these triggers are disabled during dump/restore but am not certain on that point.

David J.

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

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: Check constraints and function volatility categories
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: Check constraints and function volatility categories