Whether the below two functions can be marked immutable or not1. 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 postgresShouldn'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.