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
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.
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================== JanWieck(at)Yahoo(dot)com #
In response to
pgsql-hackers by date
|Next:||From: Karel Zak||Date: 2000-07-25 14:09:03|
|Subject: Re: New Privilege model purposal|
|Previous:||From: Philip Warner||Date: 2000-07-25 13:30:17|
|Subject: Problem with disabling triggers in pg_dump|