Skip to content

chore: add MAINTAIN support for postgres >= 17 #516

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sudo-dliberty-eiq
Copy link

The MAINTAIN privilege was added in Postgres 17.
https://www.postgresql.org/docs/17/ddl-priv.html

This change adds support for users on Postgres 17, however, opening up means users of this provider attempting to add MAINTAIN permissions on databases <= 17 will get an error.

This change addresses this issue:
#506

This pull request includes changes to the postgresql/helpers.go and postgresql/helpers_test.go files to add the new "MAINTAIN" privilege for tables. The most important changes are as follows:

Privileges update:

Test updates:

@chafouin
Copy link

chafouin commented Apr 7, 2025

Hello ! Do you think it would be possible to get a release of the provider soon with this PR merged ? That would help us to get unblocked as we are trying to add the MAINTAIN to permission to some of our users. Thanks !

@yakloinsteak
Copy link

I needed this fix as well, but though it now is able to apply MAINTAIN, if you run a plan after that, it seems that postgres has "expanded" this into individual permissions, so you're forever out of sync, oscillating between MAINTAIN and that set.

This is what happens. It either wants to do this or add the MAINTAIN priv.

~ privileges        = [
    - "MAINTAIN",
    + "DELETE",
    + "INSERT",
    + "REFERENCES",
    + "SELECT",
    + "TRIGGER",
    + "TRUNCATE",
    + "UPDATE",
  ]

I think the fix might need to account for this, but I haven't done a lot of testing. I'm going to replace all of our MAINTAINs with this set and move on, though supporting this priv would be nice.

@ooaklee
Copy link

ooaklee commented May 13, 2025

Any update on this?

@sudo-dliberty-eiq
Copy link
Author

Just waiting on approval to merge by a reviewer with write access

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.

5 participants