Create Sequence Permission for Postgres



  • When my postgres function is tries to create a new sequence, it returns a permission denied error. It looks like the only way to make it work is to give Create permission on schema using the below statement.

    GRANT CREATE ON SCHEMA public to "myuser"
    

    But, this will allow the user to create any other type of object as well, including tables. How can we control this? I want my user to be able to create a sequence, but not tables.

    Note: Create is not a valid grant on Sequences.



  • There is no way to do this using permissions. The only option would be to create an https://www.postgresql.org/docs/current/event-triggers.html that throws an exception if an undesirable object is created.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2