Re: Can I check if somebody is superuser in stored procedure?

Поиск
Список
Период
Сортировка
От Jim Nasby
Тема Re: Can I check if somebody is superuser in stored procedure?
Дата
Msg-id 0C066B83-8A3A-4E44-AC08-6DD9E74FE72F@nasby.net
обсуждение исходный текст
Ответ на Re: Can I check if somebody is superuser in stored procedure?  (Pavel Stehule <pavel.stehule@gmail.com>)
Ответы Re: Can I check if somebody is superuser in stored procedure?  (Peter Eisentraut <peter_e@gmx.net>)
Список pgsql-hackers
On Mar 28, 2011, at 1:29 AM, Pavel Stehule wrote:
>>> Is there some simple possibility to check a rights from stored procedure?
>>
>> Well, there's the catalog lookup method:
>>
>> SELECT EXISTS (SELECT 1 FROM pg_catalog.pg_roles WHERE rolname=$1 AND rolsuper)
>>
>> Is that what you had in mind?
>
> I found this too, but it isn't what I searched - I searched a some
> exported function based on internal cache.
>
> For my purpose is this solution enough.

Note that doesn't work if the user has superuser because it was granted via another role.
--
Jim C. Nasby, Database Architect                   jim@nasby.net
512.569.9461 (cell)                         http://jim.nasby.net




В списке pgsql-hackers по дате отправления:

Предыдущее
От: aaronenabs
Дата:
Сообщение: Re: Transaction log
Следующее
От: Jim Nasby
Дата:
Сообщение: Re: Triggers on system catalog