Re: support for CREATE MODULE

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Swaha Miller <swaha(dot)miller(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: support for CREATE MODULE
Date: 2022-02-03 04:25:27
Message-ID: CAFj8pRDjg=X446dQv0Ya+ae4Yq0HQGyrwWNAh=xc+fU6DcA2yg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi

čt 3. 2. 2022 v 3:28 odesílatel Swaha Miller <swaha(dot)miller(at)gmail(dot)com>
napsal:

> Hi,
>
> I'm following up from Jim's POC for adding MODULE to PostgreSQL. [1]
>
> My proposal implements modules as schema objects to be stored in a new
> system catalog pg_module with new syntax for CREATE [OR REPLACE] MODULE,
> ALTER MODULE, DROP MODULE and for GRANT and REVOKE for privileges on
> modules and module routines. I am attempting to follow the SQL spec.
> However, for right now, I'm proposing to support only routines as module
> contents, with local temporary tables and path specifications as defined
> in the SQL spec, to be supported in a future submission. We could also
> include support for variables depending on its status. [2]
>
> Following are some examples of what the new module syntax would look
> like. The attached patch has detailed documentation.
>
> CREATE MODULE mtest1 CREATE FUNCTION m1testa() RETURNS text
> LANGUAGE sql
> RETURN '1x';
> SELECT mtest1.m1testa();
> ALTER MODULE mtest1 CREATE FUNCTION m1testd() RETURNS text
> LANGUAGE sql
> RETURN 'm1testd';
> SELECT mtest1.m1testd();
> ALTER MODULE mtest1 RENAME TO mtest1renamed;
> SELECT mtest1renamed.m1testd();
> REVOKE ON MODULE mtest1 REFERENCES ON FUNCTION m1testa() FROM public;
> GRANT ON MODULE mtest1 REFERENCES ON FUNCTION m1testa() TO
> regress_priv_user1;
>
> I am new to the PostgreSQL community and would really appreciate your
> input and feedback.
>

I dislike this feature. The modules are partially redundant to schemas and
to extensions in Postgres, and I am sure, so there is no reason to
introduce this.

What is the benefit against schemas and extensions?

Regards

Pavel

>
> Thanks,
> Swaha Miller
> Amazon Web Services
>
> [1]
> https://www.postgresql.org/message-id/CAB_5SRebSCjO12%3DnLsaLCBw2vnkiNH7jcNchirPc0yQ2KmiknQ%40mail.gmail.com
>
> [2]
> https://www.postgresql.org/message-id/flat/CAFj8pRD053CY_N4%3D6SvPe7ke6xPbh%3DK50LUAOwjC3jm8Me9Obg%40mail.gmail.com
>
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Julien Rouhaud 2022-02-03 04:28:05 Re: Unclear problem reports
Previous Message Bharath Rupireddy 2022-02-03 04:15:08 Re: Avoid erroring out when unable to remove or parse logical rewrite files to save checkpoint work