Re: current_role of caller of a DEFINER function

2024-06-26 Thread Dominique Devienne
On Wed, Jun 26, 2024 at 2:42 PM David G. Johnston wrote: > On Wednesday, June 26, 2024, Dominique Devienne wrote: >> Only session_user >> is representative of the caller, and reliable (modulo SUPERUSER and >> SET AUTHORIZATION, but that's a different story and kinda normal) > > Why can you not us

Re: current_role of caller of a DEFINER function

2024-06-26 Thread Isaac Morland
On Wed, 26 Jun 2024 at 08:42, David G. Johnston wrote: > On Wednesday, June 26, 2024, Dominique Devienne > wrote: > >> Only session_user >> is representative of the caller, and reliable (modulo SUPERUSER and >> SET AUTHORIZATION, but that's a different story and kinda normal) >> > > Why can you

Re: current_role of caller of a DEFINER function

2024-06-26 Thread David G. Johnston
On Wednesday, June 26, 2024, Dominique Devienne wrote: > Only session_user > is representative of the caller, and reliable (modulo SUPERUSER and > SET AUTHORIZATION, but that's a different story and kinda normal) > Why can you not use session_user then? David J.

Re: current_role of caller of a DEFINER function

2024-06-26 Thread Dominique Devienne
On Wed, Jun 26, 2024 at 12:11 PM wrote: > Dominique Devienne: > > 1) Is there any way to know the current_role of the caller of a > > DEFINER function. I fear the answer is no, but better be sure from > > experts here. > > You can do something like this: > > CREATE DOMAIN current_user_only AS text

Re: current_role of caller of a DEFINER function

2024-06-26 Thread walther
Dominique Devienne: 1) Is there any way to know the current_role of the caller of a DEFINER function. I fear the answer is no, but better be sure from experts here. You can do something like this: CREATE DOMAIN current_user_only AS text CONSTRAINT current_user_only CHECK (VALUE = CURRENT_USE

Re: current_role of caller of a DEFINER function

2024-06-26 Thread Erik Wienhold
On 2024-06-26 10:35 +0200, Dominique Devienne wrote: > Hi. I was led to believe (by an hallucination...) that I could know > the current_role of the caller of a DEFINER function, but after actual > experimentation, turns out it shows the OWNER of the function, and not > the current_role of the call

Re: current_role of caller of a DEFINER function

2024-06-26 Thread Laurenz Albe
On Wed, 2024-06-26 at 10:35 +0200, Dominique Devienne wrote: > So I have two questions: > 1) Is there any way to know the current_role of the caller of a > DEFINER function. I fear the answer is no, but better be sure from > experts here. > 2) Why isn't there a way to obtain the above? What harm wo

current_role of caller of a DEFINER function

2024-06-26 Thread Dominique Devienne
Hi. I was led to believe (by an hallucination...) that I could know the current_role of the caller of a DEFINER function, but after actual experimentation, turns out it shows the OWNER of the function, and not the current_role of the caller. I foolishly thought curent_role != current_user inside t