Re: How to temporarily disable a table's FK constraints?

Поиск
Список
Период
Сортировка
От Ron Johnson
Тема Re: How to temporarily disable a table's FK constraints?
Дата
Msg-id 472F53CB.1000707@cox.net
обсуждение исходный текст
Ответ на How to temporarily disable a table's FK constraints?  ("Kynn Jones" <kynnjo@gmail.com>)
Список pgsql-general
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 11/05/07 10:50, Kynn Jones wrote:
> Hi, everyone.
>
> Is there a standard way to disable a table foreign-key constraint temporarily?
>
> I thought that this would be a fairly common thing to want to do, but
> I only found this snippet online:
>
> -- to disable
> UPDATE pg_class SET reltriggers=0 WHERE relname = 'your_table';
>
> -- to re-enable
> UPDATE pg_class SET reltriggers = count( * )
>   FROM pg_trigger WHERE pg_class.oid=tgrelid AND relname = 'your_table';
>
> and it appears that one needs to be root to execute these statements.
>
> Is there any other way for non-root users?

The whole idea of enforcing Relational Integrity in the database
engine is to *not* allow "regular users" to bypass data integrity
checks.

- --
Ron Johnson, Jr.
Jefferson LA  USA

Give a man a fish, and he eats for a day.
Hit him with a fish, and he goes away for good!

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD4DBQFHL1PLS9HxQb37XmcRAm7zAKDbdYSymz3zIyKmfdU5wPjtpVTAlwCYoEA/
DI1Z2Fbgo62k6C2P8gsCQQ==
=Np96
-----END PGP SIGNATURE-----

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

Предыдущее
От: Erik Jones
Дата:
Сообщение: Re: How to temporarily disable a table's FK constraints?
Следующее
От: Keith Carr
Дата:
Сообщение: Bitemporal sequenced unique constraint (function/trigger)