PostgreSQL Maestro online Help
Prev | Return to chapter overview | Next |
Row Security Policies
![](/i/tour-under-title.gif)
Row Security Policies have been implemented in PostgreSQL 9.5. They allow you to restrict, on a per-user basis, which rows can be returned by normal queries or inserted, updated, or deleted by data modification commands. Note that row-level security must be enabled on the table (using ALTER TABLE ... ENABLE ROW LEVEL SECURITY) in order for created policies to be applied.
Command
The command to which the policy applies. Valid options are ALL, SELECT, INSERT, UPDATE, and DELETE. ALL is the default.
Roles
The role(s) to which the policy is to be applied. The default is PUBLIC, which will apply the policy to all roles.
Using Expression
Any SQL conditional expression (returning boolean). This expression will be added to queries that refer to the table if row level security is enabled. Rows for which the expression returns true will be visible. Any rows for which the expression returns false or null will not be visible to the user (in a SELECT), and will not be available for modification (in an UPDATE or DELETE).
Check Expression
Any SQL conditional expression (returning boolean). This expression will be used in INSERT and UPDATE queries against the table if row level security is enabled. Only rows for which the expression evaluates to true will be allowed.
Prev | Return to chapter overview | Next |