I need a new user but it should be granted all those privileges that the other existing user/role has.
e.g.
If a new User B is created, I need the same privileges as,
Dont ask why :/
Actually User A has custom privileges on different tables, schemas, and functions; so its very tedious and lengthy process to manually grant permissions to the new user. Any help would be good.
Try something like:
GRANT A TO B;
It will grant all right of role A to B.
For details read this
chapter of the manual.
First understand that roles
and users
are the same thing. In fact there isn't a thing called a user
really, it's just a ROLE
with a LOGIN
option.
Second roles
can be granted to other roles
.
Third priviledges on roles can be inherited.
So assuming you have created your user a
like:
CREATE ROLE A LOGIN;
GRANT SELECT ON table1 TO a;
GRANT EXECUTE ON FUNCTION xxx TO a;
You should be able to create a second role that mirrors the first role like:
CREATE ROLE b LOGIN;
GRANT a TO b;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With