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.kla...@aklaver.com



Reply via email to