From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: nickbarnes01@gmail.com
Subject: BUG #15310: pg_upgrade dissociates event triggers from extensions
Date: Tue, 07 Aug 2018 00:13:58 +0000
Message-ID: <153360083872.1395.4593932457718151600@wrigleys.postgresql.org> (raw)
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, nickbarnes01@gmail.com
Subject: Re: BUG #15310: pg_upgrade dissociates event triggers from extensions
In-Reply-To: <153360083872.1395.4593932457718151600@wrigleys.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox