Whenever an object is created in a database, an owner is assigned to it. The owner is usually the one who executed the creation statement. For most kinds of objects, the initial state is that only the owner (or a superuser) can modify or delete the object. To allow other roles or users to use it, privileges or permission must be granted. Different kinds of privileges in PostgreSQL are − SELECT, INSERT, UPDATE, DELETE, TRUNCATE, REFERENCES, TRIGGER, CREATE, CONNECT, TEMPORARY, EXECUTE, and USAGE Depending on the type of the object (table, function, etc.,), privileges are applied to the object. To assign privileges to the users, the GRANT command is used. Syntax for GRANT Basic syntax for GRANT command is as follows − GRANT privilege [, ...] ON object [, ...] TO { PUBLIC | GROUP group | username } privilege − values could be: SELECT, INSERT, UPDATE, DELETE, RULE, ALL. object − The name of an object to which to grant access. The possible objects are: table, view, seque...
Comments
Post a Comment