Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----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-----

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
       subscribe-nomail command to majordomo@xxxxxxxxxxxxxx so that your
       message can get through to the mailing list cleanly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux