Re: Clarification on RLS policy
От
Adrian Klaver
Тема
Re: Clarification on RLS policy
Дата
Msg-id
8b745873-f008-41ec-b58e-4b167e266b29@aklaver.com
Ответ на
Re: Clarification on RLS policy (Vydehi Ganti)
Список
Дерево обсуждения
Clarification on RLS policy Vydehi Ganti <rayudugs@gmail.com>
Re: Clarification on RLS policy Laurenz Albe <laurenz.albe@cybertec.at>
Re: Clarification on RLS policy Dominique Devienne <ddevienne@gmail.com>
Re: Clarification on RLS policy Vydehi Ganti <rayudugs@gmail.com>
Re: Clarification on RLS policy Achilleas Mantzios - cloud <a.mantzios@cloud.gatewaynet.com>
Re: Clarification on RLS policy Adrian Klaver <adrian.klaver@aklaver.com>
Re: Clarification on RLS policy Dominique Devienne <ddevienne@gmail.com>
Re: Clarification on RLS policy Vydehi Ganti <rayudugs@gmail.com>
Re: Clarification on RLS policy Dominique Devienne <ddevienne@gmail.com>
Re: Clarification on RLS policy Vydehi Ganti <rayudugs@gmail.com>
Re: Clarification on RLS policy Dominique Devienne <ddevienne@gmail.com>
Re: Clarification on RLS policy Vydehi Ganti <rayudugs@gmail.com>
Re: Clarification on RLS policy Dominique Devienne <ddevienne@gmail.com>
Re: Clarification on RLS policy Achilleas Mantzios - cloud <a.mantzios@cloud.gatewaynet.com>
On 4/25/25 06:01, Vydehi Ganti wrote:
> This is my Scenario:
>
> *Can you please guide how to achieve this?*
>
> CREATE OR REPLACE FUNCTION one.get_country(
> powner name,
> ptable_name name)
> RETURNS character varying
> LANGUAGE 'plpgsql'
>
> For the below policy statement it created the policy but i cant call that
> CREATE POLICY "Codebase_Filter"
> ON one.activity
> FOR SELECT
> TO one
> USING (one.get_country('one','activity'));
The core of the issue you are getting is that this from the function:
RETURNS character varying
is not going to work here:
USING (one.get_country('one','activity'))
as what USING will see is a string not the evaluation of 1=1 hence the
error you get:
ERROR: invalid input syntax for type boolean: "1=1" CONTEXT: PL/pgSQL
function function name(name,name) while casting return value to
function's return type
--
Adrian Klaver
adrian.klaver@aklaver.com
В списке pgsql-general по дате отправления