Обсуждение: How to correct: ERROR: permission denied: "RI_ConstraintTrigger_24966" is a system trigger

Поиск
Список
Период
Сортировка

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

От
Andre Lopes
Дата:
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]

This is known problem? How to solve this?


Best Regards,

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

От
Craig Ringer
Дата:
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

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

От
Andre Lopes
Дата:
Hi,

I have created a database and all tables with a user, but I can't
execute this alter table:

[code]
xxx_database=> ALTER TABLE tdir_categories DISABLE TRIGGER ALL;
ERROR:  permission denied: "RI_ConstraintTrigger_25366" is a system trigger
[/code]

What can I do to solve this?

Best Regards,



On Tue, Oct 18, 2011 at 9:08 AM, Craig Ringer <ringerc@ringerc.id.au> wrote:
> 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
>

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

От
Adrian Klaver
Дата:
On Tuesday, October 18, 2011 2:42:00 am Andre Lopes wrote:
> Hi,
>
> I have created a database and all tables with a user, but I can't
> execute this alter table:
>
> [code]
> xxx_database=> ALTER TABLE tdir_categories DISABLE TRIGGER ALL;
> ERROR:  permission denied: "RI_ConstraintTrigger_25366" is a system trigger
> [/code]
>
> What can I do to solve this?

As pointed out below, you need to be a superuser. You can check the the
superuser status of users by doing \du at the psql command line and looking in
the attributes column.

>
> Best Regards,
>

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

--
Adrian Klaver
adrian.klaver@gmail.com