Re: disable and enable trigger all when a foreign keys

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: disable and enable trigger all when a foreign keys
Дата
Msg-id 26583.1562940265@sss.pgh.pa.us
обсуждение исходный текст
Ответ на disable and enable trigger all when a foreign keys  (Emanuel Araújo <eacshm@gmail.com>)
Ответы Re: disable and enable trigger all when a foreign keys  (Adrian Klaver <adrian.klaver@aklaver.com>)
Список pgsql-general
=?UTF-8?Q?Emanuel_Ara=C3=BAjo?= <eacshm@gmail.com> writes:
> This is a situation when we needed fill a new store data in a family env.
> When I run "alter table a disable trigger all;" ... the foreign key
> "a_id_b_fkey" was disabled to, its ok, but I needed run a load data into
> tables "a"and "b" and table a exists a tuple that not exists in column id_b
> -> (references b(id)).

> When finished, the command "alter table a enable trigger all" was executed
> but not alert or broken, why? Cause orphan record is there.

> This behavior is common or when doing "enable trigger all" PostgreSQL
> whould show me a error or a warning?

Well, yeah, DISABLE TRIGGER ALL defeats enforcement of FK constraints.
That's why you have to be superuser to use it[1].  Perhaps disabling
only user triggers would have been the way to do what you want.

            regards, tom lane

[1] The general assumption in PG is that superusers know what they're
doing.



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

Предыдущее
От: Emanuel Araújo
Дата:
Сообщение: disable and enable trigger all when a foreign keys
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: disable and enable trigger all when a foreign keys