I have a superuser for a PostgreSQL database, let's call him userX.
How can I make a new superuser (let's call him userY) with all the same permissions, access, etc…?
Basically, I want a clone of everything about userX to userY and keep both users.
Best Answer
Well, if you have an existing superuser role called "super1", you could do:
And, in theory at least, any of super1's privileges would be transferred over to super2. However, I'm not sure your question makes much sense, since superusers generally are allowed to override any privilege checks. As the documentation explains:
I'd be interested to hear what privileges your existing superuser role had which were not automatically granted to whatever new superuser role you created by default.
Edit: and if you're interested in copying over the per-role configuration parameters (i.e. those documented under configuration parameters), then you could use a function like this (demo only, you may need extra error handling, security considerations, etc. for production use):