Postgres update privileges




















The key word PUBLIC indicates that the privileges are to be granted to all roles, including those that might be created later. Any particular role will have the sum of privileges granted directly to it, privileges granted to any role it is presently a member of, and privileges granted to PUBLIC.

Without a grant option, the recipient cannot do that. There is no need to grant privileges to the owner of an object usually the user that created it , as the owner has all privileges by default.

The owner could, however, choose to revoke some of his own privileges for safety. The right to drop an object, or to alter its definition in any way, is not treated as a grantable privilege; it is inherent in the owner, and cannot be granted or revoked. However, a similar effect can be obtained by granting or revoking membership in the role that owns the object; see below. The owner implicitly has all grant options for the object, too. The object owner can of course revoke these privileges.

For maximum security, issue the REVOKE in the same transaction that creates the object; then there is no window in which another user can use the object. For sequences, this privilege also allows the use of the currval function.

For large objects, this privilege allows the object to be read. If specific columns are listed, only those columns may be assigned to in the INSERT command other columns will therefore receive default values. For sequences, this privilege allows the use of the nextval and setval functions.

For large objects, this privilege allows writing or truncating the object. To create a foreign key constraint, it is necessary to have this privilege on both the referencing and referenced columns. The privilege may be granted for all columns of a table, or just specific columns.

Allows the creation of a trigger on the specified table. For schemas, allows new objects to be created within the schema. To rename an existing object, you must own the object and have this privilege for the containing schema.

For tablespaces, allows tables, indexes, and temporary files to be created within the tablespace, and allows databases to be created that have the tablespace as their default tablespace. Note that revoking this privilege will not alter the placement of existing objects.

Allows the user to connect to the specified database. Allows the use of the specified function and the use of any operators that are implemented on top of the function.

This is the only type of privilege that is applicable to functions. This syntax works for aggregate functions, as well. For procedural languages, allows the use of the specified language for the creation of functions in that language. Table-like objects in PostgreSQL include a table, a view, materialized view, etc. You can also grant the insert privilege on a specific column allowing insert rows into only the set columns.

Similar to the insert permission, you can set it on a specific column to allow the user to update rows of a specific column s only. This requires that the user have the SELECT permission since it needs to reference table columns to verify the rows to be dropped. It can also allow a user to install extensions on a database. If this permission is revoked on a user, it does not remove all the existing objects until the termination point.

For most kinds of objects, the initial state is that only the owner or a superuser can do anything with the object. To allow other roles to use it, privileges must be granted.

The privileges applicable to a particular object vary depending on the object's type table, function, etc. The following sections and chapters will also show you how those privileges are used. An object can be assigned to a new owner with an ALTER command of the appropriate kind for the object, e. Superusers can always do this; ordinary roles can only do it if they are both the current owner of the object or a member of the owning role and a member of the new owning role.

For example, if joe is an existing user, and accounts is an existing table, the privilege to update the table can be granted with:.

Writing ALL in place of a specific privilege grants all privileges that are relevant for the object type.



0コメント

  • 1000 / 1000