From: | Craig Ringer <craig(at)2ndquadrant(dot)com> |
---|---|
To: | Abhijit Menon-Sen <ams(at)2ndquadrant(dot)com> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: dealing with extension dependencies that aren't quite 'e' |
Date: | 2016-01-18 08:03:53 |
Message-ID: | CAMsr+YHqNVb6sxWC5MDy+=F=dFaYiTkq35+Sp2pVxGN6rOYvBg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 15 January 2016 at 14:26, Abhijit Menon-Sen <ams(at)2ndquadrant(dot)com> wrote:
> * «DROP EXTENSION ext» won't work without adding CASCADE, which is an
> (admittedly relatively minor) inconvenience to users.
>
> * More importantly, pg_dump will dump all those trigger definitions,
> which is inappropriate in this case because the extension will try
> to create them.
>
>
I dealt with both of those in BDR (and pglogical), where we create TRUNCATE
triggers to capture and replicate table truncation. The triggers are
created either during node creation/join by a SQL function that calls into
C code, or via an event trigger on CREATE TABLE for subsequent creations.
Creating them tgisinternal gets you both properties you need IIRC.
Certainly it hides them from pg_dump, which was the requirement for me.
You can't easily create a tgisinternal trigger from SQL. You can hack it
but it's ugly. It's simple enough to just create from C. See:
https://github.com/2ndQuadrant/bdr/blob/5567302d8112c5422efc80fc43d79cd347afe09b/bdr_executor.c#L393
Other people are doing it the hacky way already, see e.g.:
https://github.com/zombodb/zombodb/commit/c801a2b766bad729a22547e0a26c17cf80ec279e
Rather than overloading 'e', we could introduce a new dependency type
> that references an extension, but means that the dependent object should
> be dropped when the extension is, but it can also be dropped on its own,
> and pg_dump should ignore it.
So ... kind of like tgisinternal and 'i' dependencies, but without the
restriction on the object being dropped directly?
Is there any particular reason the user needs to be able to drop the
created trigger directly?
Is it reasonable to endorse the use of 'i' dependencies by extensions
instead?
--
Craig Ringer http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
From | Date | Subject | |
---|---|---|---|
Next Message | Craig Ringer | 2016-01-18 08:10:16 | Re: Do we need SQL-level access to amoptions functions? |
Previous Message | Ioseph Kim | 2016-01-18 07:12:35 | Re: PGCon 2016 call for papers |