Re: How to correct: ERROR: permission denied: "RI_ConstraintTrigger_24966" is a system trigger

From: Craig Ringer <ringerc(at)ringerc(dot)id(dot)au>
To: Andre Lopes <lopes80andre(at)gmail(dot)com>
Cc: postgresql Forums <pgsql-general(at)postgresql(dot)org>
Subject: Re: How to correct: ERROR: permission denied: "RI_ConstraintTrigger_24966" is a system trigger
Date: 2011-10-18 08:08:08
Message-ID: 4E9D33E8.3050405@ringerc.id.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 10/18/2011 03:52 PM, Andre Lopes wrote:
> Hi,
>
> I have created a database that have a function that disable triggers
> on tables, but when I execute the function: (I have created the
> database with the same user that I'm trying to execute the function)
>
> [code]
> select triggerall(false);
> [/code]
>
> return
>
> [code]
> ERROR: permission denied: "RI_ConstraintTrigger_24966" is a system trigger
> CONTEXT: SQL statement "ALTER TABLE tdir_languages DISABLE TRIGGER ALL"
> PL/pgSQL function "triggerall" line 14 at EXECUTE statement
> [/code]

You're trying to disable triggers associated with foreign key
constraints or CHECK constraints, too. You should probably skip those
system triggers in your function.

If you want to disable them too, I think you have to be the table owner,
or maybe superuser; I don't remember and haven tested. In any case, the
user you're running as doesn't have permission to disable those.

--
Craig Ringer

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alban Hertroys 2011-10-18 08:22:50 Re: plpgsql; execute query inside exists
Previous Message jozsef.kurucz 2011-10-18 07:57:54 Re: plpgsql; execute query inside exists