Re: support for CREATE MODULE - Mailing list pgsql-hackers

From Robert Haas
Subject Re: support for CREATE MODULE
Date
Msg-id CA+TgmoZNvhK7QcXW=pQiDkkjCs_ZWj-v=p6Y3rsF8W1nxoWKnA@mail.gmail.com
Whole thread Raw
In response to Re: support for CREATE MODULE  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
List pgsql-hackers
On Thu, Feb 10, 2022 at 4:17 PM Alvaro Herrera <alvherre@alvh.no-ip.org> wrote:
> On 2022-Feb-04, Tom Lane wrote:
> > If we invent modules I think they need to work more like extensions
> > naming-wise, ie they group objects but have no effect for naming.
>
> I think modules are an orthogonal concept to extensions, and trying to
> mix both is messy.
>
> The way I see modules working is as a "logical" grouping of objects --
> they provide encapsulated units of functionality.  A module has private
> functions, which cannot be called except from other functions in the
> same module.  You can abstract them out of the database design, leaving
> you with only the exposed functions, the public API.
>
> An extension is a way to distribute or package objects.  An extension
> can contain a module, and of course you should be able to use an
> extension to distribute a module, or even several modules.  In fact, I
> think it should be possible to have several extensions contribute
> different objects to the same module.
>
> But things like name resolution rules (search path) are not affected by
> how the objects are distributed, whereas the search path is critical in
> how you think about the objects in a module.
>
> If modules are just going to be extensions, I see no point.

+1.

I think that extensions, as we have them in PostgreSQL today, are
basically feature-complete. In my experience, they do all the things
that we need them to do, and pretty well. I think Tom was correct when
he predicted many years ago that getting the extension feature into
PostgreSQL would be remembered as one the biggest improvements of that
era. (I do not recall his exact words.)

But the same is clearly not true of schemas. Schemas are missing
features that people expect to have, private objects being one of
them, and variables another, and I think there are other things
missing, too. Also, search_path is an absolutely wretched design and
I'd propose ripping it out if I had any sensible idea what would
replace it.

IMHO, if we're going to do anything at all in this area, it ought to
be targeting the rather-large weaknesses of the schema system, rather
than anything about the extension system.

-- 
Robert Haas
EDB: http://www.enterprisedb.com



pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: [Proposal] Fully WAL logged CREATE DATABASE - No Checkpoints
Next
From: Robert Haas
Date:
Subject: Re: [Proposal] Fully WAL logged CREATE DATABASE - No Checkpoints