Skip to content

Navigation Menu

Sign in
Sign up

Remove alter function set_updated_at() owner to postgres; - #258

Open
JWDobken wants to merge 1 commit into
stripe:main from
JWDobken:patch-1
Open

Remove alter function set_updated_at() owner to postgres; #258
JWDobken wants to merge 1 commit into
stripe:main from
JWDobken:patch-1

Conversation

@JWDobken

@JWDobken JWDobken commented Jan 20, 2026

Copy link
Copy Markdown

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.

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.
end;
$$;

alter function set_updated_at() owner to postgres;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

cla-assistant Bot commented May 18, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@kevcodez kevcodez kevcodez left review comments

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /