[HACKERS] RLS policy not getting honer while pg_dump on declarative partition

Поиск
Список
Период
Сортировка
От Rushabh Lathia
Тема [HACKERS] RLS policy not getting honer while pg_dump on declarative partition
Дата
Msg-id CAGPqQf1+teEvS4NF8teabN+Q-e4S=pE=Ty_rGO5kA0ZcXTeCSg@mail.gmail.com
обсуждение исходный текст
Ответы Re: [HACKERS] RLS policy not getting honer while pg_dump ondeclarative partition  (Stephen Frost <sfrost@snowman.net>)
Список pgsql-hackers
While doing some testing I noticed that RLS policy not getting honer
while pg_dump on declarative partition.

I can understand that while doing SELECT on individual child
table, policy of parent is not getting applied. But is this desirable
behaviour? I think for partitions, any policy on the root table should
get redirect to the child, thoughts?

If current behaviour is desirable then atleast we should document this.

Consider the below test:

\c postgres rushabh

CREATE USER rls_test_user1;

CREATE TABLE tp_sales
(
    visibility         VARCHAR(30),
    sales_region       VARCHAR(30)
) PARTITION BY LIST (sales_region);

create table tp_sales_p_india  partition of tp_sales for values in ('INDIA');
create table tp_sales_p_rest  partition of tp_sales for values in ('REST');

insert into tp_sales values ( 'hidden', 'INDIA');
insert into tp_sales values ( 'visible', 'INDIA');
insert into tp_sales values ( 'hidden', 'REST');
insert into tp_sales values ( 'visible', 'REST');

GRANT SELECT ON tp_sales to rls_test_user1;
GRANT SELECT ON tp_sales_p_india to rls_test_user1;
GRANT SELECT ON tp_sales_p_rest to rls_test_user1;

ALTER TABLE tp_sales ENABLE ROW LEVEL SECURITY;

CREATE POLICY dump_p1 ON tp_sales FOR ALL USING (visibility = 'visible');

\c - rls_test_user1

-- SELECT honer the policy
SELECT * FROM tp_sales;

When we run the pg_dump using user rls_test_user1, can see the hidden
rows in the pg_dump output.

./db/bin/pg_dump -U rls_test_user1 postgres --inserts

Attaching the dump output.


Thanks,
Rushabh Lathia
www.EnterpriseDB.com

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Masahiko Sawada
Дата:
Сообщение: Re: [HACKERS] logical replication: \dRp+ and "for all tables"
Следующее
От: Konstantin Knizhnik
Дата:
Сообщение: Re: [HACKERS] WIP: Data at rest encryption