Setting session global variables

Поиск
Список
Период
Сортировка
От Kyle
Тема Setting session global variables
Дата
Msg-id 3B03E6CC.6D2A30FE@actarg.com
обсуждение исходный текст
Список pgsql-sql
 
Is there a way to set a session global variable in PostgreSQL?  The only
thing I see are examples of setting config variables.
Not sure if session variables are your best solution, but here's how you implement them:

-- Warning: this defines a global variable in the tcl interpretor.  This could
-- crash with other TCL procedures if the same name were used during the same connection.

-- Store a value in a variable.  This is helpful for caching values in a transaction
-- Calling sequence: store(variable,value)
create function store(text,text) returns int4 as '
    global store_vars
    return [set store_vars($1) $2]
    ' LANGUAGE 'pltcl';

-- Fetch a value from a variable.
-- Calling sequence: recall(variable)
create function recall(text) returns int4 as '
    global store_vars
    return [subst $store_vars($1)]
    ' LANGUAGE 'pltcl';
 
 

Вложения

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

Предыдущее
От: George Moga
Дата:
Сообщение: Re: how to add an new record from part of an old one
Следующее
От: Forest Wilkinson
Дата:
Сообщение: ON UPDATE CASCADE overhead?