January 2019
Beginner
556 pages
14h 19m
English
Row-level security (RLS), also known as row security policy, is used to control access to the table rows, including INSERT, UPDATE, SELECT, and DELETE. Table truncate as well as referential integrity constraints, such as the primary key and unique and foreign keys, are not subject to row security. In addition to this, superusers bypass the row-level security. To enable row security, you need to use the ALTER statement for each table, as follows:
ALTER TABLE <table_name> ENABLE ROW LEVEL SECURITY
In order to use RLS, you need to define some polices on how a certain role or roles in the database can access a certain set of rows. For this reason, often, the role is embedded in the tables. The following sample code creates ...
Read now
Unlock full access