On Thu, Feb 10, 2022 at 4:17 PM Alvaro Herrera <alvhe...@alvh.no-ip.org> wrote: > On 2022-Feb-04, Tom Lane wrote: > > If we invent modules I think they need to work more like extensions > > naming-wise, ie they group objects but have no effect for naming. > > I think modules are an orthogonal concept to extensions, and trying to > mix both is messy. > > The way I see modules working is as a "logical" grouping of objects -- > they provide encapsulated units of functionality. A module has private > functions, which cannot be called except from other functions in the > same module. You can abstract them out of the database design, leaving > you with only the exposed functions, the public API. > > An extension is a way to distribute or package objects. An extension > can contain a module, and of course you should be able to use an > extension to distribute a module, or even several modules. In fact, I > think it should be possible to have several extensions contribute > different objects to the same module. > > But things like name resolution rules (search path) are not affected by > how the objects are distributed, whereas the search path is critical in > how you think about the objects in a module. > > If modules are just going to be extensions, I see no point.
+1. I think that extensions, as we have them in PostgreSQL today, are basically feature-complete. In my experience, they do all the things that we need them to do, and pretty well. I think Tom was correct when he predicted many years ago that getting the extension feature into PostgreSQL would be remembered as one the biggest improvements of that era. (I do not recall his exact words.) But the same is clearly not true of schemas. Schemas are missing features that people expect to have, private objects being one of them, and variables another, and I think there are other things missing, too. Also, search_path is an absolutely wretched design and I'd propose ripping it out if I had any sensible idea what would replace it. IMHO, if we're going to do anything at all in this area, it ought to be targeting the rather-large weaknesses of the schema system, rather than anything about the extension system. -- Robert Haas EDB: http://www.enterprisedb.com