From: | Erik Wienhold <ewie(at)ewie(dot)name> |
---|---|
To: | Dominique Devienne <ddevienne(at)gmail(dot)com> |
Cc: | pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | Re: current_role of caller of a DEFINER function |
Date: | 2024-06-26 10:06:29 |
Message-ID: | de84eeae-f173-4e8b-9532-e54482370309@ewie.name |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
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 caller.
>
> I foolishly thought curent_role != current_user inside the DEFINER
> function, but reading back the doc, it's clear current_role =
> current_user = user, thus that was wishful thinking. Only session_user
> is representative of the caller, and reliable (modulo SUPERUSER and
> SET AUTHORIZATION, but that's a different story and kinda normal)
>
> 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.
Have you tried capturing current_user with a function parameter and
default value?
https://www.postgresql.org/message-id/f82f70fd-665f-6384-5e8a-987ab9e640d3%40technowledgy.de
--
Erik
From | Date | Subject | |
---|---|---|---|
Next Message | walther | 2024-06-26 10:11:26 | Re: current_role of caller of a DEFINER function |
Previous Message | Laurenz Albe | 2024-06-26 09:08:16 | Re: current_role of caller of a DEFINER function |