I have a large set of user-defined procedures which need to be used on several separate catalogs (databases).
The built-in procedures normally seen in pg_catalog.pg_proc appear to be reflected in the pg_catalog schemas of all the databases. I was hoping that creating a function in the postgres database might make it accessible universally, but no, whether created in the postgres.pg_catalog or postgres.public schema.
Does anyone know how I can make user-defined procedures available universally?
I've tried faking namespace and owner, granting execute to public, and holding a black cat over my left shoulder (but not during a full moon).
Will setting it up as an extension work? (That may take some negotiating and finagling for my environment is the only reason I haven't tried it yet.)
Thanks in advance
plpgsqlis available by default because the extension is installed intemplate1; there's no cross-database magic going on. You'll need to roll this out to each database individually. Fortunately, as you can see from @Neil's answer, it's pretty straightforward.