Skip to content

postgres: automatically set schema permissions - #216

Merged
Andrei Kvapil (kvaps) merged 1 commit into
mainfrom
postgres-schema-fix
Jul 22, 2024
Merged

Andrei Kvapil (kvaps) merged 1 commit into
mainfrom
postgres-schema-fix

Conversation

@kvaps

@kvaps Andrei Kvapil (kvaps) commented Jul 15, 2024 •

Copy link
Copy Markdown
Member

This PR refactors postgress configuration script:

  • Added event trigger on creating new schemas for automatically set owner
  • Refactored logic for fixing permissions for all objects in all schemas

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.

There are a lot of logic requests and each of the requests may not be failed, transactionality is needed here, quite significant changes. We don't cover it with unit tests and it doesn't really make sense to do it, but we have to understand what this logic does perfectly, and have a guarantee that either a number of requests are failed or we rollback and return error message.

I understand that you would like to add these changes, if you take these risks on yourself and describe how it will work when one of the requests is not executed correctly, then I think we can try to add these changes. And this is a rather dubious improvement, if others have such code in their product, it does not mean that we should follow their mistakes.

@kvaps

Andrei Kvapil (kvaps) commented Jul 19, 2024 •

Copy link
Copy Markdown
Member Author

Sure. This trigger added only for schema creation, in case if it failed the SQL command will be rolled back. This will not affect logic for existing public schema, as most of the applications using exactly it.

Changes are tested locally, the same logic applies for ferretdb

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants