Re: Support for CREATE MODULE?

From: "Joel Jacobson" <joel(at)compiler(dot)org>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Support for CREATE MODULE?
Date: 2021-06-02 15:22:11
Message-ID: 09820999-b84d-4046-a45f-4eacf92ff3ca@www.fastmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jun 2, 2021, at 16:43, Jim Mlodgenski wrote:
> On Wed, Jun 2, 2021 at 9:58 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us <mailto:tgl%40sss.pgh.pa.us>> wrote:
> > I wonder whether it'd be better to consider modules as a kind of
> > extension, or at least things with the same sort of ownership relations
> > as extensions have.
>
> That would solve the problem of associating objects which is the larger
> problem for users today. The objects can all live in their respective
> schemas with the module tying them all together.

I like the idea of somehow using extensions.

Right now, extensions can only be added from the command-line, via `make install`.

But maybe a new extension could be packaged from the SQL prompt, out of existing database objects that are not already part of an extension?

Maybe the interface could be:

init_new_extension(extension_name text) function, to register a new empty extension.
add_object_to_extension(extension_name text, type text, object_names text[], object_args text[])

Then, if dropping the extension, all objects would be dropped, and if creating the extension, all objects would be restored.

I don't have an idea on how to handle update scripts, but since it's not mandatory to provide extension update scripts, maybe that's not a problem.

/Joel

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2021-06-02 15:42:29 Re: pg_stat_progress_create_index vs. parallel index builds
Previous Message Tom Lane 2021-06-02 15:14:36 Re: Support for CREATE MODULE?