Wanted: ALTER TRIGGER ... OWNED BY EXTENSION - Mailing list pgsql-general

From Moshe Jacobson
Subject Wanted: ALTER TRIGGER ... OWNED BY EXTENSION
Date
Msg-id CAJ4CxLmxxv3+S3ReV78DvmfDSTVkVDVLoLqb426qXY6f8TvySQ@mail.gmail.com
Whole thread Raw
Responses Re: Wanted: ALTER TRIGGER ... OWNED BY EXTENSION  (Alvaro Herrera <alvherre@2ndquadrant.com>)
List pgsql-general
An extension I'm working on dynamically creates trigger functions and installs them on tables in public. The triggers are automatically created when one of the extension's config tables is populated.

Even though I mark the trigger functions as owned by my extension, the trigger definitions themselves are still dumped by pg_dump and restored by pg_restore. This is a problem when pg_restore is using parallelism (-j), and one thread starts issuing CREATE TRIGGER commands before the other thread has finished populating the config table.

What ends up happening is pg_restore throws a whole lot of errors saying that the function referenced by the CREATE TRIGGER command does not exist. However, the function and trigger are actually created later on once the config table is populated.

Using pg_restore without -j is a workaround, but I'd really like to be able to mark my extension's triggers as owned by the extension, so that these errors will not show up when restoring. 

Is there a better workaround that I'm not aware of?

Thanks.

Moshe Jacobson
Manager of Systems Engineering, Nead Werx Inc.
2323 Cumberland Parkway · Suite 201 · Atlanta, GA 30339

"Quality is not an act, it is a habit." -- Aristotle

pgsql-general by date:

Previous
From: Raymond O'Donnell
Date:
Subject: Re: Complex query
Next
From: Leonardo M. Ramé
Date:
Subject: Re: Complex query