Re: Converting contrib SQL functions to new style
Tom Lane <tgl@sss.pgh.pa.us>
Mark Dilger <mark.dilger@enterprisedb.com> writes: >> On Apr 13, 2021, at 3:26 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote: >> However I think we may still need an assumption that earthdistance >> and cube are in the same schema --- any comments on that? > This is probably not worth doing, and we are already past feature > freeze, but adding syntax to look up the namespace of an extension might > help. Yeah, that idea was discussed before (perhaps only in private security-team threads, though). We didn't do anything about it because at the time there didn't seem to be pressing need, but in the context of SQL function bodies there's an obvious use-case. > We could get something like this working just inside the CREATE EXTENSION command if we expanded on the @extschema@ idea a bit. At first I thought this idea would suffer race conditions with concurrent modifications of pg_extension or pg_namespace, but it looks like we already have a snapshot when processing the script file, so: > -CREATE DOMAIN earth AS cube > +CREATE DOMAIN @@earthdistance@@::earth AS @@cube@@::cube Right, extending the @extschema@ mechanism is what was discussed, though I think I'd lean towards something like @extschema:cube@ to denote the schema of a referenced extension "cube". I'm not sure this is useful enough to break feature freeze for, but I'm +1 for investigating it for v15. regards, tom lane
Commits
-
Use @extschema:name@ notation in contrib transform modules.
- bebe9040388b 18.0 landed
-
pg_freespacemap: Fix declaration of pg_freespace(regclass)
- e0c3d5122e6a 18.0 landed
-
contrib/pageinspect: Use SQL-standard function bodies.
- 68ff25eef125 18.0 landed
-
contrib/xml2: Use SQL-standard function bodies.
- 667368fd26de 18.0 landed
-
contrib/citext: Use SQL-standard function bodies.
- 97a5a16849eb 18.0 landed
-
contrib/earthdistance: Use SQL-standard function bodies.
- 969bbd0fafc0 18.0 landed
- 3652de36e432 17.3 landed
- 31daa10facec 16.7 landed
-
contrib/lo: Use SQL-standard function bodies
- 13e3796c906b 18.0 landed
-
xml2: Add tests for functions xpath_nodeset() and xpath_list()
- 93f9b4a93fef 18.0 landed
-
contrib/lo: Add test for function lo_oid()
- 3ef038fc4f76 18.0 landed
-
pg_freespacemap: Use SQL-standard function bodies
- 3f323eba89fb 18.0 landed
-
Add @extschema:name@ and no_relocate options to extensions.
- 72a5b1fc8804 16.0 cited
-
Make contrib modules' installation scripts more secure.
- 7eeb1d9861b0 14.0 cited