Conversation
…default, loadable by postgres
PostgreSQL Extension Dependency Analysis: PR #2105
SummaryNo extensions had dependencies with MAJOR version updates. Full Analysis ResultsPostgreSQL 15 Extension DependenciesExtension: http
Raw Dependency TreeExtension: hypopg
Raw Dependency TreeExtension: pg_graphql
Raw Dependency TreeExtension: pg_hashids
Raw Dependency TreeExtension: pg_jsonschema
Raw Dependency TreeExtension: pg_repack
Raw Dependency TreeExtension: pg_stat_monitor
Raw Dependency TreeExtension: pg_tle
Raw Dependency TreeExtension: pgaudit
Raw Dependency TreeExtension: pgroonga
Raw Dependency TreeExtension: pgsodium
Raw Dependency TreeExtension: pgtap
Raw Dependency TreeExtension: postgis
Raw Dependency TreeExtension: rum
Raw Dependency TreeExtension: supabase_vault
Raw Dependency TreeExtension: vector
Raw Dependency TreeExtension: wal2json
Raw Dependency Tree |
PostgreSQL Package Dependency Analysis: PR #2105
SummaryNo packages had MAJOR version updates. Full Analysis ResultsPostgreSQL 15 Dependency ChangesExtracting PostgreSQL 15 dependencies...
Runtime Closure Size
Raw Dependency ClosurePostgreSQL 17 Dependency ChangesExtracting PostgreSQL 17 dependencies...
Runtime Closure Size
Raw Dependency Closure |
| ALTER ROLE anon SET local_preload_libraries = '$libdir/plugins/safeupdate'; | ||
| ALTER ROLE authenticator SET local_preload_libraries = '$libdir/plugins/safeupdate'; | ||
| ALTER ROLE authenticated SET local_preload_libraries = '$libdir/plugins/safeupdate'; | ||
| ALTER ROLE authenticator RESET session_preload_libraries; |
There was a problem hiding this comment.
Would this nullify session_preload_libraries? We would need that to at least include supautils considering #2113
There was a problem hiding this comment.
We can also close this PR and roll the changes into the one linked?
Just to summarize, |
| ALTER ROLE anon SET local_preload_libraries = '$libdir/plugins/safeupdate'; | ||
| ALTER ROLE authenticator SET local_preload_libraries = '$libdir/plugins/safeupdate'; | ||
| ALTER ROLE authenticated SET local_preload_libraries = '$libdir/plugins/safeupdate'; |
There was a problem hiding this comment.
It doesn't make sense to add local_preload_libraries to anon or authenticated since they never start a connection, they're only impersonated roles (only active through a SET LOCAL <role>). As pg docs say this setting only works at "connection start".
| ALTER ROLE anon SET local_preload_libraries = '$libdir/plugins/safeupdate'; | |
| ALTER ROLE authenticator SET local_preload_libraries = '$libdir/plugins/safeupdate'; | |
| ALTER ROLE authenticated SET local_preload_libraries = '$libdir/plugins/safeupdate'; | |
| ALTER ROLE authenticator SET local_preload_libraries = '$libdir/plugins/safeupdate'; |
There was a problem hiding this comment.
good point, thanks, will modify these to session_preload_libraries
| ALTER ROLE anon SET safeupdate.enabled = 1; | ||
| ALTER ROLE authenticator SET safeupdate.enabled = 1; | ||
| ALTER ROLE authenticated SET safeupdate.enabled = 1; | ||
| ALTER ROLE postgres SET safeupdate.enabled = 0; |
There was a problem hiding this comment.
Ditto
| ALTER ROLE anon SET safeupdate.enabled = 1; | |
| ALTER ROLE authenticator SET safeupdate.enabled = 1; | |
| ALTER ROLE authenticated SET safeupdate.enabled = 1; | |
| ALTER ROLE postgres SET safeupdate.enabled = 0; | |
| ALTER ROLE authenticator SET safeupdate.enabled = 1; | |
| ALTER ROLE postgres SET safeupdate.enabled = 0; |
There was a problem hiding this comment.
From a quick manual test it seems safeupdate has been working well for Data API/PostgREST, anon and authenticated have it enabled. This is thanks to authenticator having it in session_preload_libraries.
I added some feedback mentioning it's unnecessary and in fact a no-op adding local_preload_libraries to anon, authenticated.
Now, I should ask if the motivation of this PR is to have the postgres role able to use the safeupdate so other pg clients can benefit? Edit: Re-reading the original issue #1308, indeed looks this was the main motivation.
If so, we should focus on modifying the postgres role and keep the authenticator settings as is.
@steve-chavez Can you provide your test case please? Running this on |
|
@encima No, it won't work like that. postgres/migrations/db/init-scripts/00000000000000-initial-schema.sql Lines 29 to 31 in e157099 The only role that has So in SQL if you LOGIN as I only tested this through PostgREST (I don't think the $ curl -X PATCH 'https://<url>.supabase.co/rest/v1/items?select=id' -H "apikey: <redacted>" -H "Content-Type: application/json"
--data @- <<JSON
{"name": "asdf"}
JSON
{"code":"21000","details":null,"hint":null,"message":"UPDATE requires a WHERE clause"}$
$ curl -X DELETE 'https://<url>.supabase.co/rest/v1/items?select=id' -H "apikey: <redacted>" -H "Content-Type: application/json
" --data @- <<JSON
{"name": "asdf"}
JSON
{"code":"21000","details":null,"hint":null,"message":"DELETE requires a WHERE clause"}$ |
Got it, thanks. OK, so the aim of the PR is only to fix postgres not using safeupdate. If that's the case, we don't need to do any breaking changes and can just merge after I modify. |
|
Correct, it should be a pure addition without breaking changes. |
|
Maybe a new PR called |

What kind of change does this PR introduce?
Fix and feature
What is the current behavior?
Safeupdate enabled for authenticator, not loadable/usable by other roles
What is the new behavior?
Load safeupdate as a plugin so it can be loaded by any role (not just superuser)
load $libdir/plugins/safeupdateLoaded by default for anon, authenticator, authenticated and postgres.
Enabled by default for anon, authenticator and authenticated
Additional context
Supersedes #2027
session_preload_librariesis reset for authenticator role and safeupdate is only built into thepluginsdir, not into the extension dir additionally