Skip to content

Instantly share code, notes, and snippets.

@cazzer
Last active November 26, 2016 06:15
Show Gist options
  • Save cazzer/44935f2b8de5d74d8ccc82032fd8734c to your computer and use it in GitHub Desktop.
Save cazzer/44935f2b8de5d74d8ccc82032fd8734c to your computer and use it in GitHub Desktop.
Row Level Security: Policy
alter table data enable row level security;
create policy data_owner
on data
for all
to application_user
using (
(
select true as bool from (
select data_id from user_data where user_role = current_user
) as user_data where data_id = data.id
) = true
)
with check (true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment