Re: Query regarding functions of postgres

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Ayush Vatsa <ayushvatsa1810(at)gmail(dot)com>
Cc: "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Query regarding functions of postgres
Date: 2024-04-07 14:21:27
Message-ID: CAKFQuwZ95hBF+5q1qFA+jRyFzF1Af6EBBfZRF87U0Ov2xW+jKw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sunday, April 7, 2024, Ayush Vatsa <ayushvatsa1810(at)gmail(dot)com> 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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2024-04-07 15:18:13 Re: Query regarding functions of postgres
Previous Message Tony Bazeley 2024-04-07 13:18:43 Re: pg_dumpall - restoration problem- resolved