Remove alter function set_updated_at() owner to postgres;#258
Open
JWDobken wants to merge 1 commit intosupabase:mainfrom
Open
Remove alter function set_updated_at() owner to postgres;#258JWDobken wants to merge 1 commit intosupabase:mainfrom
JWDobken wants to merge 1 commit intosupabase:mainfrom
Conversation
This removes the explicit ownership change on `set_updated_at()`. This line assumes the existence of user `postgres` (which does not in my case). It will be owned by the user that creates it and that is fine.
kevcodez
reviewed
Jan 21, 2026
| end; | ||
| $$; | ||
|
|
||
| alter function set_updated_at() owner to postgres; |
Contributor
There was a problem hiding this comment.
Migrations cannot be changed right now as that would lead to a different checksum, breaking existing deployments
Once #234 lands we can modify older migrations
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This removes the explicit ownership change on
set_updated_at().This line assumes the existence of user
postgres(which does not in my case). It will be owned by the user that creates it and that is fine.What kind of change does this PR introduce?
Bug fix
What is the current behavior?
If not user postgres but another database user, you run into problems when the database user is explicitly named:
{"type":"Error","message":"Migration failed. Reason: An error occurred running 'add_updated_at'. Rolled back this migration. No further migrations were run. Reason: must be able to SET ROLE \"postgres\"","stack":"Error: Migration failed. Reason: An error occurred running 'add_updated_at'. Rolled back this migration. No further migrations were run. Reason: must be able to SET ROLE \"postgres\"\n at /app/node_modules/.pnpm/pg-node-mi grations@0.0.8/node_modules/pg-node-migrations/dist/migrate.js:108:27\n at process.processTicksAndRejections (node:internal/process/task_queues:103:5)\n at async /app/node_module s/.pnpm/pg-node-migrations@0.0.8/node_modules/pg-node-migrations/dist/with-lock.js:25:28\n at async connectAndMigrate (/app/packages/sync-engine/dist/index.cjs:2191:5)\n at async runMigrations (/app/packages/sync-engine/dist/index.cjs:2210:5)","cause":"An error occurred running 'add_updated_at'. Rolled back this migration. No further migrations were run. Reaso n: must be able to SET ROLE \"postgres\""},"msg":"Error running migrations"}What is the new behavior?
The function is now owned by the database user that creates it.