public inbox for [email protected]
help / color / mirror / Atom feedFrom: Adrian Klaver <[email protected]>
To: Vydehi Ganti <[email protected]>
To: Dominique Devienne <[email protected]>
Cc: Laurenz Albe <[email protected]>
Cc: [email protected]
Subject: Re: Clarification on RLS policy
Date: Fri, 25 Apr 2025 08:13:49 -0700
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAMH-PzXe7AR2QDCDx3eRZPMGuixfTwm3sLF3kMZQkyNhtu=5qQ@mail.gmail.com>
References: <CAMH-PzUPN7JcLXJx-aJzGnJD2T-aSMo8gaMFkzO_x26urpMqSA@mail.gmail.com>
<[email protected]>
<CAFCRh-_fXGfKk6b26xaDD1fg5OhLy92bNofmeDfX2TFjkQLLXA@mail.gmail.com>
<CAMH-PzXe7AR2QDCDx3eRZPMGuixfTwm3sLF3kMZQkyNhtu=5qQ@mail.gmail.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
[email protected]
view thread (10+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected], [email protected]
Subject: Re: Clarification on RLS policy
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox