pg_restore with --disable-triggers discards ENABLE ALWAYS

From: Duncan Sands <duncan(dot)sands(at)deepbluecap(dot)com>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: pg_restore with --disable-triggers discards ENABLE ALWAYS
Date: 2024-09-12 08:27:52
Message-ID: d374b6fc-4217-48a9-8639-2c9b4d3a92d0@deepbluecap.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

This is with postgresql version 16.4. You can reproduce as follows:

CREATE TABLE test_table(x int);
CREATE FUNCTION test_function() RETURNS trigger AS $$ BEGIN RETURN NULL; END; $$
LANGUAGE plpgsql;
CREATE TRIGGER test_trigger AFTER UPDATE ON test_table FOR EACH ROW EXECUTE
FUNCTION test_function();
ALTER TABLE test_table ENABLE ALWAYS TRIGGER test_trigger;

Checking the table:

duncan=> \d test_table
Table "public.test_table"
Column | Type | Collation | Nullable | Default
--------+---------+-----------+----------+---------
x | integer | | |
Triggers firing always:
test_trigger AFTER UPDATE ON test_table FOR EACH ROW EXECUTE FUNCTION
test_function()

^ Observe "Triggers firing always".

Now for the dump + restore:

pg_dump -f dump.custom -Fc --table test_table
pg_restore --data-only --disable-triggers --dbname duncan dump.custom

Checking the table:

duncan=> \d test_table
Table "public.test_table"
Column | Type | Collation | Nullable | Default
--------+---------+-----------+----------+---------
x | integer | | |
Triggers:
test_trigger AFTER UPDATE ON test_table FOR EACH ROW EXECUTE FUNCTION
test_function()

^ Observe that "Triggers firing always" has disappeared.

Best wishes, Duncan.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2024-09-12 08:54:42 BUG #18614: [ECPG] out of bound in DecodeDateTime
Previous Message PG Bug reporting form 2024-09-12 07:28:32 BUG #18613: Incorrect output for foreign tables with NOT NULL constraints