Re: [v9.5] Custom Plan API - Mailing list pgsql-hackers

From Robert Haas
Subject Re: [v9.5] Custom Plan API
Date
Msg-id CA+TgmoapznbT_6_k6SaPTnFWUbnAxF=ZOnR4kzv8F01Hobs92g@mail.gmail.com
Whole thread Raw
In response to Re: [v9.5] Custom Plan API  (Amit Kapila <amit.kapila16@gmail.com>)
Responses Re: [v9.5] Custom Plan API  (Amit Kapila <amit.kapila16@gmail.com>)
List pgsql-hackers
On Mon, Nov 10, 2014 at 6:55 AM, Amit Kapila <amit.kapila16@gmail.com> wrote:
> I thought that in general if user has the API to register the custom path
> methods, it should have some way to unregister them and also user might
> need to register some different custom path methods after unregistering
> the previous one's.  I think we should see what Robert or others have to
> say about this point before trying to provide such an API.

I wouldn't bother.  As KaiGai says, if you want to shut the
functionality off, the provider itself can provide a GUC.  Also, we
really have made no effort to ensure that loadable modules can be
safely unloaded, or hooked functions safely-unhooked.
ExecutorRun_hook is a good example.  Typical of hook installation is
this:
       prev_ExecutorRun = ExecutorRun_hook;       ExecutorRun_hook = pgss_ExecutorRun;

Well, if multiple extensions use this hook, then there's no hope of
unloading them exception in reverse order of installation.  We
essentially end up creating a singly-linked list of hook users, but
with the next-pointers stored in arbitrarily-named, likely-static
variables owned by the individual extensions, so that nobody can
actually traverse it.  This might be worth fixing as part of a
concerted campaign to make UNLOAD work, but unless somebody's really
going to do that I see little reason to hold this to a higher standard
than we apply elsewhere.  The ability to remove extensions from this
hook won't be valuable by itself.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: [v9.5] Custom Plan API
Next
From: Petr Jelinek
Date:
Subject: Re: Column/type dependency recording inconsistencies