BUG #15310: pg_upgrade dissociates event triggers from extensions
The Post Office <noreply@postgresql.org>
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: nickbarnes01@gmail.com
Date: 2018-08-07T00:13:58Z
Lists: pgsql-bugs
The following bug has been logged on the website: Bug reference: 15310 Logged by: Nick Barnes Email address: nickbarnes01@gmail.com PostgreSQL version: 10.4 Operating system: CentOS 7 Description: Hi, I have an extension which contains an event trigger. As expected, CREATE EXTENSION adds a pg_depend entry between the trigger and the extension. But after running pg_upgrade, this pg_depend entry is gone (and the extension's CREATE EVENT TRIGGER statement now shows up in the pg_dump output, causing the restore to fail with an "event trigger already exists" error). Reproduced for 9.5->9.6 and 9.6->10 upgrades with the attached script. Did I miss something, or is this a bug? If so, is an ALTER EXTENSION ... ADD EVENT TRIGGER command on the upgraded database enough to work around it? It solves my issue, but I'm not sure if there are other symptoms. Thanks, Nick Barnes export PGDATAOLD=~/9.5/data export PGDATANEW=~/10/data export PGBINOLD=/usr/pgsql-9.5/bin export PGBINNEW=/usr/pgsql-10/bin # Create extension files cat >$PGBINOLD/../share/extension/event_trigger_test.control <<EOF default_version = '1.0' EOF cat >$PGBINOLD/../share/extension/event_trigger_test--1.0.sql <<EOF CREATE FUNCTION t() RETURNS event_trigger LANGUAGE plpgsql AS 'BEGIN END'; CREATE EVENT TRIGGER t ON ddl_command_end EXECUTE PROCEDURE t(); EOF cp $PGBINOLD/../share/extension/event_trigger_test* $PGBINNEW/../share/extension/ # Set up old server $PGBINOLD/initdb -D $PGDATAOLD $PGBINOLD/pg_ctl start -w -D $PGDATAOLD $PGBINOLD/createdb test $PGBINOLD/psql test -c "CREATE EXTENSION event_trigger_test" # Upgrade $PGBINOLD/pg_ctl stop -D $PGDATAOLD $PGBINNEW/initdb -D $PGDATANEW $PGBINNEW/pg_upgrade $PGBINNEW/pg_ctl start -w -D $PGDATANEW # Dump/restore $PGBINNEW/createdb test2 $PGBINNEW/pg_dump test | $PGBINNEW/psql test2 # ERROR: event trigger "t" already exists
Commits
-
Don't record FDW user mappings as members of extensions.
- f5973ac768df 9.3.25 landed
- 33c5d3bf85d7 9.4.20 landed
- 74c877e8db23 9.5.15 landed
- f3ed5364e666 9.6.11 landed
- 9446d7157740 10.6 landed
- ea1b65971066 11.0 landed
- 9b7c56d6cba9 12.0 landed
-
Fix pg_upgrade to handle event triggers in extensions correctly.
- fb4e0e8960e0 9.4.20 landed
- dfffe651e258 9.3.25 landed
- c9dacdb1c942 10.6 landed
- 92d5dd36ecf8 9.6.11 landed
- 91f6ec2994ff 9.5.15 landed
- 187331fefdb0 11.0 landed
- 03838b804905 12.0 landed