fix: isolate pg_net to pg_catalog extension - #284
AndrewJackson2020 wants to merge 1 commit into
Conversation
|
Looking into this a bit more, postgis is an example of an extension that uses tables, like |
|
Another idea: pg_cron has a similar pattern as pg_net: creates a cron schema where everything is installed, non-relocatable, etc. They hardcode the installation to pg_catalog though. Maybe we should consider this as an alternative to having pg_cron be non-relocatable but allowing it to be installed anywhere? |
Could you elaborate on the pros/cons of that? 👀 |
9e863fe to
caead29
Compare
caead29 to
010c3cc
Compare
This commit sets the only allowable place to install the net extension to pg_catalog. This is beneficial because in the absense of this the default place an extension will be installed when running `CREATE EXTENSION` will probably be public. This is often flagged as a security warning, on supabase for example but others as well. Looking at the postgres tree every procedural language is set up in this way (ie. relocatable=false, schema=pg_catalog). Besides procedural languages there is one extension that is nonrelocatable but does not specify schema though I believe that this may be an outlier. Outside of first party postgres extensions, pg_cron is also set up in this way (ie it create a cron scheam, creates all extension objects in there but ultimately the pg_cron extension itself is installed in pg_catalog and is non relocatable).
010c3cc to
5c4782c
Compare
|
I have reworked this PR to install the extension in |
|
Not opposed to non-relocatable being in pg_catalog, but I guess then #290 should be closed as "not planned"? Also, this would be a breaking change right? Not sure yet of the implications for existing deployments, that'd be the most concerning part. |
Agree this is not something I would want to merge in immediately or whatever. Converting back to draft so this doesn't get merged. Per the postgres docs this setting should only impact new extension installs.
The supabase UI ideally should be changed though looking at the the current behavior I don't think it would need to be. Notice how even if I try to install in public it doesn't fail, just ignores and installs in pg_catalog without notice. This may even be not a breaking change.
I'd be fine with it being not planned or being on the far back burner. [0] https://www.postgresql.org/docs/current/extend-extensions.html |

Currently pg_net hardcodes everything to a net schema. This schema is created in the sql scripts and is owned by the extension. Even though it has its own dedicated schema you still need to install pg_net in another schema. This ends up with no objects in that schema but it "exists" in that schema for recordkeeping purposes. This commit changes this so that pg_net is declared with the net extension in the control file.
All this being said, I think the ideal behavior is to make pg_net a relocatable extension. There are some difficulties here in that the C source code assumes the
netschemas installation. That said I feel like it is still possible. Happy to accept any feedback here.