Enabling row level security on a table in postgres is pretty straightforward:
alter table some_table enable row level security;
How would you check to see which tables in a given schema have row level security enabled (for testing)?
This is stored in pg_class
relrowsecurity
bool True if table has row level security enabled; see pg_policy catalog relforcerowsecurity
bool True if row level security (when enabled) will also apply to table owner; see pg_policy catalog So you can use:
select relname, relrowsecurity, relforcerowsecurity
from pg_class
where oid = 'your_table_name'::regclass;
Alternatively use pg_tables
If you want to check if row level security is enabled for lots of tables for a particular schema (in this case public) you can use:
select relname, relrowsecurity, relforcerowsecurity
from pg_class
join pg_catalog.pg_namespace n on n.oid = pg_class.relnamespace
where n.nspname = 'public' and relkind = 'r';
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.