On 25.08.2025 19:19, Dominique Devienne wrote:
From https://www.postgresql.org/docs/current/sql-altertable.html#SQL-ALTERTABLE-DESC-DISABLE-ENABLE-TRIGGER:
Disabling or enabling internally generated constraint triggers requires superuser privileges
We were disabling triggers as the owner of the table just fine, no
SUPERUSER involved. So is the doc out-of-date?
Simple experiment shows that it is still up to date:
postgres@postgres(17.5)=# set session authorization alice;
SET
alice@postgres(17.5)=> create table t (id int primary key, parent_id int references t(id));
CREATE TABLE
alice@postgres(17.5)=> select tgname from pg_trigger where tgrelid = 't'::regclass;
tgname
--------------------------------
RI_ConstraintTrigger_a_1260370
RI_ConstraintTrigger_a_1260371
RI_ConstraintTrigger_c_1260372
RI_ConstraintTrigger_c_1260373
(4 rows)
alice@postgres(17.5)=> alter table t disable trigger "RI_ConstraintTrigger_a_1260370";
ERROR: permission denied: "RI_ConstraintTrigger_a_1260370" is a system trigger
alice@postgres(17.5)=> \c - postgres
You are now connected to database "postgres" as user "postgres".
postgres@postgres(17.5)=# alter table t disable trigger "RI_ConstraintTrigger_a_1260370";
ALTER TABLE
--
Pavel Luzanov
Postgres Professional: https://postgrespro.com