GuidesSecurity & Compliance
Row-Level Security
Row-Level Security (RLS) allows for the management of access to individual data rows at the table level, enabling detailed access isolation. This feature lets administrators set specific rules that determine which table rows users can view or modify.
Scenarios
- Includes commands:
ALL
,SELECT
,INSERT
,UPDATE
,DELETE
. - Policies can be assigned to multiple roles.
- Enforced on both commands and roles.
- Commands like
TRUNCATE
andREFERENCES
do not apply to row-level permissions due to their unique operational methods.
Syntax
- policy_name: Unique within its table, but can be shared across different tables. Multiple policies on a table are treated as an OR relationship.
- USING: Verifies existing records for
SELECT
,INSERT
,UPDATE
,DELETE
, orALL
actions. - WITH CHECK: Checks records for addition or modification, applicable to
SELECT
,INSERT
,UPDATE
,DELETE
, orALL
operations.
Manage policies through the CREATE POLICY
, ALTER POLICY
, and DROP POLICY
commands.
Managing Row-Level Security
Enable RLS on the target table
Disable RLS
Examples
To learn more about RLS, visit Row Security Policies.