public inbox for [email protected]  
help / color / mirror / Atom feed
From: David G. Johnston <[email protected]>
To: Ayush Vatsa <[email protected]>
Cc: [email protected] <[email protected]>
Subject: Re: Query regarding functions of postgres
Date: Sun, 7 Apr 2024 07:21:27 -0700
Message-ID: <CAKFQuwZ95hBF+5q1qFA+jRyFzF1Af6EBBfZRF87U0Ov2xW+jKw@mail.gmail.com> (raw)
In-Reply-To: <CACX+KaM2bePqt6Oz=t2pA=B=+i2Amc9CsdR6nmbmR84M9Xs7mg@mail.gmail.com>
References: <CACX+KaM2bePqt6Oz=t2pA=B=+i2Amc9CsdR6nmbmR84M9Xs7mg@mail.gmail.com>

On Sunday, April 7, 2024, Ayush Vatsa <[email protected]> wrote:

>
> Whether the below two functions can be marked immutable or not
> 1. If a function has constant Raise notice inside it. Eg.
>

Seems legit.


>
> 2. If a function has Raise notice but extracting current user inside notice, although its output purely depends on its input arguments eg.
>
> No

select outer_function();
>
>                                       outer_function
> -------------------------------------------------------------------------------------------
>  OuterFunction() -> Current user is postgres | InnerFunction() -> Current user is postgres
>
> Shouldn't it be "InnerFunction() -> Current user is alex" instead of postgres as alex called the security invoker function
>
>
As soon as the system entered the security defined function it changed
current_user to the definer of that function and won’t change back until
the function returns.  Which it hasn’t when inner function is invoked.

David J.


view thread (2+ messages)

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]
  Subject: Re: Query regarding functions of postgres
  In-Reply-To: <CAKFQuwZ95hBF+5q1qFA+jRyFzF1Af6EBBfZRF87U0Ov2xW+jKw@mail.gmail.com>

* 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