Re: [HACKERS] Dropping extensions

From: Marc Munro <marc(at)bloodnok(dot)com>
To: Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-general(at)postgreSQL(dot)org
Subject: Re: [HACKERS] Dropping extensions
Date: 2011-08-11 22:45:59
Message-ID: 1313102759.28960.34.camel@bloodnok.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On Sat, 2011-07-30 at 22:46 +0200, Dimitri Fontaine wrote:
> Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:
> > Hmm. I don't think we have any code in there to prohibit the same
> > object from being made a member of two different extensions ... but this
> > example suggests that maybe we had better check that.
>
> I see you did take care of that, thank you!
>
> http://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=988cccc620dd8c16d77f88ede167b22056176324

I thought I'd document how I fixed Veil's drop extension issue.

The problem is that veil_init() needs to be able to do different things
depending on how Veil has been extended. In the past, we simply
re-wrote veil_init() for the application. Now that we have proper
extensions this is no longer viable.

So, I have modified veil_init() to call functions that have been defined
in a configuration table. An extension can now register its own init
functions by inserting their details into the config table.

This is almost perfect, except that when an extension is dropped, the
inserted records must be deleted.

We achieve this by creating a new config table for each extension, which
inherits from the veil config table. When veil queries its config
table, it sees the inherited tables too, and can find their init
functions. When the extension is dropped, the inherited table is also
dropped and veil_init() reverts to its previous behaviour.

Yay.
__
Marc

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2011-08-11 22:49:53 Re: Regex Query Index question
Previous Message Naoko Reeves 2011-08-11 22:26:21 Regex Query Index question

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Sabino Mullane 2011-08-12 01:44:56 Re: index-only scans
Previous Message Cédric Villemain 2011-08-11 21:39:08 Re: index-only scans