Re: Problem with disabling triggers in pg_dump - Mailing list pgsql-hackers
From | JanWieck@t-online.de (Jan Wieck) |
---|---|
Subject | Re: Problem with disabling triggers in pg_dump |
Date | |
Msg-id | 200007251352.PAA20574@hot.jw.home Whole thread Raw |
In response to | Problem with disabling triggers in pg_dump (Philip Warner <pjw@rhyme.com.au>) |
Responses |
Re: Problem with disabling triggers in pg_dump
(Philip Warner <pjw@rhyme.com.au>)
|
List | pgsql-hackers |
Philip Warner wrote: > > An interesting problem has been brought to my attention in pg_dump > (V7.0.2+, I think). > > It uses the following code to disable triggers prior to a data load: > > UPDATE "pg_class" SET "reltriggers" = 0 WHERE "relname" !~ '^pg_'; > > which works fine if it is currently connected as a superuser, or as the > datdba. However, if it is connected as anybody else, they will get the error: > > pg_class: Permission denied > > The obvious solution is to reconnect as the datdba before running the code. The above was a rude hack. Introduced because of the lack of time when we discovered the problem during 7.0 BETA cycle (IIRC). The ovious "solution" is to fix it. The clean solution would be to have something like ALTER SESSION DISABLE/ENABLE TRIGGERS A global variable (like those for other session settings) would cause the trigger manager to suppress their invocation at all. The new utility has to check if either the user has ALTER ALL TABLES privilege, or has ALTER TABLE privilege for any existing user table where triggers are defined for. Jan -- #======================================================================# # It's easier to get forgiveness for being wrong than for being right. # # Let's break this rule - forgive me. # #================================================== JanWieck@Yahoo.com #
pgsql-hackers by date: