Is it possible to grant different privileges on different tables or attributes within the one statement?
For example I want to combine:
GRANT SELECT ON tbl TO user;
and
GRANT UPDATE OF attr ON tbl TO user;
Furthermore, could I combine granting privilege on a different relation:
GRANT INSERT ON tbl2;
All in the one statement.
You can combine multiple object privileges in one
GRANT, but only for the same object. For example:But, as you can see in the manual‘s syntax diagram, each
GRANTcan only operate on one object at a time.However, you can run multiple
GRANTs as a single statement if you use theCREATE SCHEMAsyntax.If you’re looking to simplify your code, this won’t help. But if you have some technical requirement to use a single statement, it may work. For example, I’ve often found that combining DDL statements can significantly reduce the time it takes to run install scripts, especially over a slow network.