From: | Andrea Adami <fol(at)fulcro(dot)net> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | CREATE POLICY bug ? |
Date: | 2016-08-20 02:15:10 |
Message-ID: | CAJgnxO_+D_a4syJjZ8Wo4kS-o=FO5sZr2zpVmVQQHq1b-bXpgg@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hello,
i'm testing the new row security level functionality in postgresql 9.5.
To do that i run this script:
-----------cut here ----------------------
CREATE TABLE public.policy_tab
(
id bigint NOT NULL,
description character varying(160) NOT NULL,
usr name NOT NULL,
CONSTRAINT policy_tab_pk PRIMARY KEY (id)
);
ALTER TABLE public.policy_tab OWNER TO postgres;
GRANT ALL ON TABLE public.policy_tab TO public;
CREATE OR REPLACE VIEW public.policy_view AS
SELECT id,
description,
usr
FROM public.policy_tab;
ALTER TABLE public.policy_view
OWNER TO postgres;
GRANT ALL ON TABLE public.policy_view TO public;
ALTER TABLE public.policy_tab ENABLE ROW LEVEL SECURITY;
CREATE POLICY standard ON public.policy_tab
FOR ALL
TO PUBLIC
USING (usr = current_user);
INSERT INTO public.policy_tab (id, description, usr) VALUES (1,'uno','
manager(at)scuola247(dot)it');
INSERT INTO public.policy_tab (id, description, usr) VALUES (2,'due','
manager(at)scuola247(dot)it');
INSERT INTO public.policy_tab (id, description, usr) VALUES (3,'tre','
manager(at)scuola247(dot)it');
INSERT INTO public.policy_tab (id, description, usr) VALUES (4,'quattro','
teacher(at)scuola247(dot)it');
INSERT INTO public.policy_tab (id, description, usr) VALUES (5,'cinque','
teacher(at)scuola247(dot)it');
-----------cut here ----------------------
after that i run the query: "select * from public.policy_tab"
and the the oupt was what i excpected:
rows 1,2,3 for user: manager(at)scuola247(dot)it
rows 4,5 for user: teacher(at)scuola247(dot)it
rows 1,2,3,4,5 for user: postgres (the policy doesn't work for him)
but when i run the query: "select * from public.policy_view"
the ouput is the same (all rows) for all users
i'm doing some mistakes or this is a bug ?
thank you in advance for the time you would like dedicate to me.
Andrea Adami
From | Date | Subject | |
---|---|---|---|
Next Message | Amit Kapila | 2016-08-20 02:50:35 | Re: Should we cacheline align PGXACT? |
Previous Message | Petr Jelinek | 2016-08-20 01:44:39 | Re: LSN as a recovery target |