Re: support for CREATE MODULE

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Swaha Miller <swaha(dot)miller(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: support for CREATE MODULE
Date: 2022-02-11 20:46:45
Message-ID: CA+TgmoZNvhK7QcXW=pQiDkkjCs_ZWj-v=p6Y3rsF8W1nxoWKnA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Feb 10, 2022 at 4:17 PM Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2022-02-11 20:47:44 Re: [Proposal] Fully WAL logged CREATE DATABASE - No Checkpoints
Previous Message Andrew Dunstan 2022-02-11 20:40:15 Re: [Proposal] Fully WAL logged CREATE DATABASE - No Checkpoints