On 10.10.2012 03:45, Peter Eisentraut wrote:
> About that plugins directory ($libdir/plugins) ... I don't think we ever
> really got that to work sensibly. I don't remember the original design
> discussion, but I have seen a number of explanations offered over the
> years. It's not clear who decides what to put in there (plugin author,
> packager, DBA?), how to put it there (move it, copy it, symlink it? --
> no support in pgxs), and based on what criteria.
Yeah, it would be good to clarify that. It was originally added for the
pldebugger module
(http://archives.postgresql.org/pgsql-hackers/2006-07/msg00803.php), but
I couldn't find any discussion on the decision to create a new 'plugins'
directory.
It was never quite enough for pldebugger, as you still needed to add it
to shared_preload_libraries for it to work, at least if you wanted to
get the full functionality. The installation procedure in the README
clearly instructs to add it to shared_preload_libraries, it doesn't say
anything about local_preload_libraries. I recently refactored pldebugger
to not install in the plugins directory anymore, it now just drops it in
$libdir.
> It would seem to be much more in the spirit of things to simply list the
> allowed plugins in a GUC variable, like
>
> some_clever_name_here = $libdir/this, $libdir/that
>
> but there is probably a reason why this wasn't done that way in the
> first place.
I think the idea was that plugins directory would be easier for
users/admins. I agree that a GUC like above feels more natural.
Now that we support include-directories in postgresql.conf, you could
put a "mylib.conf" file in the include directory that contains the above
line, if you want to enable/disable a module just by moving things
around in the filesystem (after configuring an include directory in
postgresql.conf). But actually, you can't, because there's no way to
append to a setting, you can only override. That's an obvious missing
feature in the include mechanism. Even ignoring the plugins directory,
it would be nice to be able to append libraries to shared_preload_libraries.
- Heikki