BUG #9442: Cannot pg_dump database with event trigger: cannot duplicate null pointer. - Mailing list pgsql-bugs

From mcheciches@gmail.com
Subject BUG #9442: Cannot pg_dump database with event trigger: cannot duplicate null pointer.
Date
Msg-id 20140305120520.1918.871@wrigleys.postgresql.org
Whole thread Raw
Responses Re: BUG #9442: Cannot pg_dump database with event trigger: cannot duplicate null pointer.
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      9442
Logged by:          CHECICHES Marius-Cristian
Email address:      mcheciches@gmail.com
PostgreSQL version: 9.3.0
Operating system:   Oracle SunOS 5.11 Solaris 11.1
Description:

Note: I will try and not give away internal information as much as
possible.

The server is hosted on Solaris 11(operating system field). The pg_dump
utility was run remotely on Windows Server 2008 R2 Enterprise.

Command:    pg-9.3\pg_dump.exe -h <host> -p <port> -U <user> -F d -w -v -j 4
-f "<path>" <database>
This is run daily on a few small databases.
As soon as I implemented an event trigger it failed.

The trigger script:

=== trigger.sql
=========================================================================================

DROP EVENT TRIGGER IF EXISTS upd_perm_event_trigger;

CREATE EVENT TRIGGER upd_perm_event_trigger ON ddl_command_end
WHEN TAG IN ('CREATE TABLE', 'CREATE SEQUENCE', 'CREATE SCHEMA')
EXECUTE PROCEDURE upd_perm_trigger_fun(); --Set necessary permisions for new
relations

=========================================================================================================

I am aware of the ALTER DEFAULT PRIVILEGES feature, but I had my reasons to
prefer a trigger for this.
Anyway, the point is that pg_dump failed.

pg_dump logs (lines starting with '#' are comments added by me):

=== pg_dump.log ===============================================

pg_dump: reading schemas
pg_dump: reading user-defined tables
pg_dump: reading extensions
pg_dump: reading user-defined functions
pg_dump: reading user-defined types
pg_dump: reading procedural languages
pg_dump: reading user-defined aggregate functions
pg_dump: reading user-defined operators
pg_dump: reading user-defined operator classes
pg_dump: reading user-defined operator families
pg_dump: reading user-defined text search parsers
pg_dump: reading user-defined text search templates
pg_dump: reading user-defined text search dictionaries
pg_dump: reading user-defined text search configurations
pg_dump: reading user-defined foreign-data wrappers
pg_dump: reading user-defined foreign servers
pg_dump: reading default privileges
pg_dump: reading user-defined collations
pg_dump: reading user-defined conversions
pg_dump: reading type casts
pg_dump: reading table inheritance information
pg_dump: reading event triggers
pg_dump: finding extension members
pg_dump: finding inheritance relationships
pg_dump: reading column info for interesting tables
# START repeat for tables
pg_dump: finding the columns and types of table "<table>"
pg_dump: finding default expressions of table "<table>"
# END repeat
pg_dump: flagging inherited columns in subtables
pg_dump: reading indexes
# START repeat for tables
pg_dump: reading indexes for table "<table>"
# END repeat
pg_dump: reading constraints
pg_dump: reading triggers
pg_dump: reading rewrite rules
pg_dump: reading large objects
pg_dump: reading dependency data
pg_dump: saving encoding = UTF8
pg_dump: saving standard_conforming_strings = on
pg_dump: saving database definition
cannot duplicate null pointer (internal error)

================================================================

The logs were the same for each database. After I dropped the trigger and
re-run the
command it worked.
Note: I only dropped the trigger itself. The trigger function remained and
was dumped.

The new logs would end (normally) with:

====================================================
pg_dump: saving database definition
# START repeat for tables
pg_dump: dumping contents of table <table>
# END repeat
====================================================

I found no related information in the server-side log files.

pgsql-bugs by date:

Previous
From: Patrick Boake
Date:
Subject: Re: BUG #9416: Setting up postgresql-9.1 (9.1.12-0wheezy1) Fails Configuration
Next
From: Tom Lane
Date:
Subject: Re: BUG #9442: Cannot pg_dump database with event trigger: cannot duplicate null pointer.