RE: Ability to reference other extensions by schema in extension scripts

From: "Regina Obe" <lr(at)pcorp(dot)us>
To: "'Tom Lane'" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, <strk(at)kbt(dot)io>
Cc: <pgsql-hackers(at)postgresql(dot)org>
Subject: RE: Ability to reference other extensions by schema in extension scripts
Date: 2022-11-23 04:24:19
Message-ID: 004b01d8fef3$752dbf30$5f893d90$@pcorp.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>
> "Regina Obe" <lr(at)pcorp(dot)us> writes:
> >> I have a distinct sense of deja vu here. I think this idea, or
> >> something isomorphic to it, was previously discussed with some other
> syntax details.
>
> > I found the old discussion I recalled having and Stephen had suggested
> > using @extschema{'postgis'}@ On this thread --
> > https://www.postgresql.org/message-
> id/20160425232251(dot)GR10850(at)tamriel(dot)s
> > nowman.net
> > Is that the one you remember?
>
> Hmmm ... no, ISTM it was considerably more recent than that.
> [ ...digs... ] Here we go, it was in the discussion around converting
contrib SQL
> functions to new-style:
>
> https://www.postgresql.org/message-
> id/flat/3395418.1618352794%40sss.pgh.pa.us
>
> There are a few different ideas bandied around in there.
> Personally I still like the @extschema:extensionname@ option the best,
> though.
>
> regards, tom lane

Here is first version of my patch using the @extschema:extensionname@ syntax
you proposed.

This patch includes:
1) Changes to replace references of @extschema:extensionname@ with the
schema of the required extension
2) Documentation for the feature
3) Tests for the feature.

There is one issue I thought about that is not addressed by this.

If an extension is required by another extension and that required extension
schema is referenced in the extension scripts using the
@extschema:extensionname@ syntax, then ideally we should prevent the
required extension from being relocatable. This would prevent a user from
accidentally moving the required extension, thus breaking the dependent
extensions.

I didn't add that feature cause I wasn't sure if it was overstepping the
bounds of what should be done, or if we leave it up to the user to just know
better.

Thanks,
Regina

Attachment Content-Type Size
0001-Allow-use-of-extschema-reqextname-to-reference.patch application/octet-stream 12.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message John Naylor 2022-11-23 04:35:17 Re: Non-decimal integer literals
Previous Message Greg Stark 2022-11-23 03:50:19 Re: [PoC] configurable out of disk space elog level