Postgres 12 RLS
От | Laura Smith |
---|---|
Тема | Postgres 12 RLS |
Дата | |
Msg-id | HQQTmWw2GOI540iQNVYlo-Hdq7FXd-L1Iyq1g3SOen8t-jugIBcwQ1FCKngTRnZ4wwttn1z5mMLbQrS5aK_srLa6HKN6mFUOoiUDtS__y0I=@protonmail.ch обсуждение исходный текст |
Ответы |
Re: Postgres 12 RLS
|
Список | pgsql-general |
Hi, I'm having a little trouble with RLS in Postgres 12, although first time I've used RLS, so it might just be me ! The problem is that I am calling a function from a web-app, but the function seems to be executing as "postgres" even thouhgthe web-app logs in as a completely different role ? This means that current_user in the function resolves to "postgres" instead of the app user. This is an example of a function : create function addses(p_regid text,p_msgid text,p_reqid text) returns integer AS $$ BEGIN UPDATE foo_regs set reg_aws_ses_msgid=p_msgid,reg_aws_amzn_requestid=p_reqid where uuid=p_regid; IF FOUND THEN return 1; ELSE return 0; END IF; END; $$ LANGUAGE plpgsql SECURITY DEFINER; grant execute on function addses(p_regid text,p_msgid text,p_reqid text) to myappuser; The foo_regs table has the following RLS policy: Policies: POLICY "foo_regs_policy" USING (((event_id = CURRENT_USER) AND (reg_hide IS FALSE)))
В списке pgsql-general по дате отправления: