Loading topic
GRANT and REVOKE. You should also be comfortable using psql or another5 min readCREATE POLICY, and how to read each part of the command. It assumes you can write basic SQL, create tables, use GRANT, and run psql. It also assumes you have seen that ALTER TABLE ... ENABLE ROW LEVEL SECURITY makes a tab5 min readALTER TABLE ... ENABLE ROW LEVEL SECURITY and CREATE POLICY once. It also assumes you know how to create roles and GRANT privileges, and that you can switch roles in psql. The chapter covers the two expressions a policy can carry, whi6 min readGRANT, and know that ENABLE ROW LEVEL SECURITY turns a table to default deny. It also assumes you have written a first CREATE POLICY with USING and WITH CHECK. Here you will split one broad policy into separate 6 min readCREATE POLICY, USING, and WITH CHECK from the earlier chapters, and that you are comfortable with CREATE ROLE, GRANT, and group roles. Here you decide which roles a policy applies to. You also learn how that choice interacts with privileges, role membership, a5 min readCREATE POLICY statement, you know the difference between USING and WITH CHECK, and you have used SET ROLE to test as another role. It covers how PostgreSQL combines several policies on one table, and how to choose between the two policy types.5 min readCREATE POLICY statements with USING and WITH CHECK, and that you understand PostgreSQL roles, GRANT, and SET ROLE. The earlier chapters covered the default-deny behavior. Here the question is which sessions never see that behavior at all, and how to close5 min readCREATE POLICY with USING and WITH CHECK, and that you know how GRANT and SET ROLE work. A policy is only as useful as the facts it can see. The policy needs to know who is asking, and in a shared-table design it must also know which tenant that pe6 min readCREATE POLICY and know USING from WITH CHECK. It also assumes you know how roles and GRANT work, and that you can use psql. The goal is to check that a policy does what you meant, from the role's point of view, before real users find out.6 min readUSING and WITH CHECK policies, and know that table owners and BYPASSRLS roles skip policies unless FORCE is set. It uses the documents table, with its documents_owner policy, and the alice and bob roles from earlier chapte5 min readEXPLAIN plan, have created B-tree indexes, and know the earlier chapters' material on USING, permissive and restrictive policies, and set_config. It covers what RLS costs, how to see that cost, and how to reduce it.6 min readUSING or WITH CHECK expression reads another table. It assumes you can write a basic policy, you know the difference between USING and WITH CHECK, and you know which roles bypass RLS. It also assumes the roles alice and bob exist from the earlier exampl5 min readcurrent_setting, set_config, FORCE ROW LEVEL SECURITY, and how USING and WITH CHECK differ. The policies themselves are usually fine. The failures happen around them: how the applicati5 min read