public inbox for [email protected]  
help / color / mirror / Atom feed
DISABLE TRIGGER doc wrong?
4+ messages / 3 participants
[nested] [flat]

* DISABLE TRIGGER doc wrong?
@ 2025-08-25 16:19 Dominique Devienne <[email protected]>
  2025-08-25 17:13 ` Re: DISABLE TRIGGER doc wrong? Pavel Luzanov <[email protected]>
  0 siblings, 1 reply; 4+ messages in thread

From: Dominique Devienne @ 2025-08-25 16:19 UTC (permalink / raw)
  To: [email protected]

or I'm reading it wrong? --DD

From https://www.postgresql.org/docs/current/sql-altertable.html#SQL-ALTERTABLE-DESC-DISABLE-ENABLE-TRIGG...:
> 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?

PS: By mistake... We were ALTER TABLE {}.{} DISABLE TRIGGER ALL
  when we meant ALTER TABLE {}.{} DISABLE TRIGGER USER






^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: DISABLE TRIGGER doc wrong?
  2025-08-25 16:19 DISABLE TRIGGER doc wrong? Dominique Devienne <[email protected]>
@ 2025-08-25 17:13 ` Pavel Luzanov <[email protected]>
  2025-08-25 17:24   ` Re: DISABLE TRIGGER doc wrong? Dominique Devienne <[email protected]>
  0 siblings, 1 reply; 4+ messages in thread

From: Pavel Luzanov @ 2025-08-25 17:13 UTC (permalink / raw)
  To: Dominique Devienne <[email protected]>; [email protected]

On 25.08.2025 19:19, Dominique Devienne wrote:
> Fromhttps://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


^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: DISABLE TRIGGER doc wrong?
  2025-08-25 16:19 DISABLE TRIGGER doc wrong? Dominique Devienne <[email protected]>
  2025-08-25 17:13 ` Re: DISABLE TRIGGER doc wrong? Pavel Luzanov <[email protected]>
@ 2025-08-25 17:24   ` Dominique Devienne <[email protected]>
  2025-08-25 17:33     ` Re: DISABLE TRIGGER doc wrong? Adrian Klaver <[email protected]>
  0 siblings, 1 reply; 4+ messages in thread

From: Dominique Devienne @ 2025-08-25 17:24 UTC (permalink / raw)
  To: Pavel Luzanov <[email protected]>; +Cc: [email protected]

On Mon, Aug 25, 2025 at 7:13 PM Pavel Luzanov <[email protected]> wrote:
> On 25.08.2025 19:19, Dominique Devienne wrote:
> Simple experiment shows that it is still up to date:

> 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

We were using ALL, successfully but incorrectly, and are now using
USER, successfully.
Not a named constraint trigger as you did. Could it be ALL implicitly
excludes such constraint triggers, when not SUPERUSER? And thus, as
the table owner, ALL == USER, implicitly? If that's the case, then the
doc still needs clarifications IMHO. --DD






^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: DISABLE TRIGGER doc wrong?
  2025-08-25 16:19 DISABLE TRIGGER doc wrong? Dominique Devienne <[email protected]>
  2025-08-25 17:13 ` Re: DISABLE TRIGGER doc wrong? Pavel Luzanov <[email protected]>
  2025-08-25 17:24   ` Re: DISABLE TRIGGER doc wrong? Dominique Devienne <[email protected]>
@ 2025-08-25 17:33     ` Adrian Klaver <[email protected]>
  0 siblings, 0 replies; 4+ messages in thread

From: Adrian Klaver @ 2025-08-25 17:33 UTC (permalink / raw)
  To: Dominique Devienne <[email protected]>; Pavel Luzanov <[email protected]>; +Cc: [email protected]

On 8/25/25 10:24, Dominique Devienne wrote:
> On Mon, Aug 25, 2025 at 7:13 PM Pavel Luzanov <[email protected]> wrote:
>> On 25.08.2025 19:19, Dominique Devienne wrote:
>> Simple experiment shows that it is still up to date:
> 
>> 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
> 
> We were using ALL, successfully but incorrectly, and are now using
> USER, successfully.
> Not a named constraint trigger as you did. Could it be ALL implicitly
> excludes such constraint triggers, when not SUPERUSER? And thus, as
> the table owner, ALL == USER, implicitly? If that's the case, then the
> doc still needs clarifications IMHO. --DD
> 
> 

I am not seeing it:


select version();
                                                               version 

-----------------------------------------------------------------------------------------------------------------------------------
  PostgreSQL 17.6 (Ubuntu 17.6-1.pgdg22.04+1) on x86_64-pc-linux-gnu, 
compiled by gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0, 64-bit


create table test_table_parent(id integer primary key, fld varchar);
create table test_table_child(id integer primary key, fld_child varchar, 
parent_id integer references test_table_parent on update cascade);

\dt+ test_table_child
                                             List of tables
  Schema |       Name       | Type  |  Owner  | Persistence | Access 
method |    Size    | Description
--------+------------------+-------+---------+-------------+---------------+------------+-------------
  public | test_table_child | table | db_user | permanent   | heap 
    | 8192 bytes | NULL


\du+ db_user
             List of roles
  Role name | Attributes | Description
-----------+------------+-------------
  db_user   |            |

alter table test_table_child disable  trigger all;
ERROR:  permission denied: "RI_ConstraintTrigger_c_121933" is a system 
trigger


-- 
Adrian Klaver
[email protected]






^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2025-08-25 17:33 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-08-25 16:19 DISABLE TRIGGER doc wrong? Dominique Devienne <[email protected]>
2025-08-25 17:13 ` Pavel Luzanov <[email protected]>
2025-08-25 17:24   ` Dominique Devienne <[email protected]>
2025-08-25 17:33     ` Adrian Klaver <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox