Re: Current database name

Поиск
Список
Период
Сортировка
От Manuel Sugawara
Тема Re: Current database name
Дата
Msg-id m3puci38t0.fsf@dep1.fciencias.unam.mx
обсуждение исходный текст
Ответ на Current database name  (Alexander Solianic <solianic@yahoo.com>)
Список pgsql-general
Alexander Solianic <solianic@yahoo.com> writes:

> Hi, Posgres Gurus!
>
> Does anybody know if there's a way to get name of the current
> session's database in stored procedure, i.e. something like
> CURRENT_USER variable?

what's wrong with current_user?

create function my_user() returns text as '
declare
  var_res text;
begin
  select current_user into var_res;
  return var_res;
end;
' language 'plpgsql';

regression=# select my_func();
 my_func
---------
 masm
(1 row)

hth,
Manuel.

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: timeout for a transaction
Следующее
От: "Tim Barnard"
Дата:
Сообщение: Re: [ADMIN] Limiting simultaneous connections