Skip to content

Instantly share code, notes, and snippets.

@cdaringe
Created July 19, 2018 00:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cdaringe/85dd9a7b1278afe4770869dc494216f3 to your computer and use it in GitHub Desktop.
Save cdaringe/85dd9a7b1278afe4770869dc494216f3 to your computer and use it in GitHub Desktop.
postgres-rls-rejecting-inserts-with-loose-policy
testing=> \d testing.report_files
Table "testing.report_files"
Column | Type | Modifiers
---------------------+---------+------------------------------------------------------------------
id | integer | not null default nextval('testing.report_files_id_seq'::regclass)
idp_organization_id | text | not null
name | text | not null
description | text |
Indexes:
"report_files_pkey" PRIMARY KEY, btree (id)
"unique_report_name_in_org" UNIQUE, btree (idp_organization_id, name)
"report_idpoid" btree (idp_organization_id)
Policies:
POLICY "files" FOR ALL
USING (true)
testing=> insert into testing.report_files (idp_organization_id, name, description) values ('1', 'a', 'b');
ERROR: permission denied for sequence report_files_id_seq
testing=> select * from testing.report_files;
id | idp_organization_id | name | description
----+---------------------+---------------+---------------------------
1 | 1 | test_report_0 | test_report_0_description
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment