Re: Support for CREATE MODULE? - Mailing list pgsql-hackers

From Joel Jacobson
Subject Re: Support for CREATE MODULE?
Date
Msg-id 09820999-b84d-4046-a45f-4eacf92ff3ca@www.fastmail.com
Whole thread Raw
In response to Re: Support for CREATE MODULE?  (Jim Mlodgenski <jimmy76@gmail.com>)
List 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@sss.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

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Support for CREATE MODULE?
Next
From: Tomas Vondra
Date:
Subject: Re: pg_stat_progress_create_index vs. parallel index builds