How to define global variable in postgresql

Started by EazonGuoover 14 years ago5 messages
#1EazonGuo
eazonguo@gmail.com

Hello. How can we define a global variable in postgresql?

--
Best regards

Eazon

#2Christopher Browne
cbbrowne@gmail.com
In reply to: EazonGuo (#1)
Re: How to define global variable in postgresql

On Fri, Aug 19, 2011 at 10:58 AM, EazonGuo <eazonguo@gmail.com> wrote:

Hello. How can we define a global variable in postgresql?

I believe CREATE TABLE is the usual mechanism to do this sort of thing.
--
When confronted by a difficult problem, solve it by reducing it to the
question, "How would the Lone Ranger handle this?"

#3Florian Weimer
fweimer@bfk.de
In reply to: EazonGuo (#1)
Re: How to define global variable in postgresql

Hello. How can we define a global variable in postgresql?

Do you mean session-private, but persistent across transactions?
Configuration parameters can be abused for this purpose.

--
Florian Weimer <fweimer@bfk.de>
BFK edv-consulting GmbH http://www.bfk.de/
Kriegsstraße 100 tel: +49-721-96201-1
D-76133 Karlsruhe fax: +49-721-96201-99

In reply to: EazonGuo (#1)
Re: How to define global variable in postgresql

Hello. How can we define a global variable in postgresql?

you can also use global structure in plpython for example:

http://www.postgresql.org/docs/9.0/static/plpython-sharing.html

#5Jim Nasby
jim@nasby.net
In reply to: Valentine Gogichashvili (#4)
Re: How to define global variable in postgresql

On Aug 19, 2011, at 4:15 PM, Valentine Gogichashvili wrote:

Hello. How can we define a global variable in postgresql?

you can also use global structure in plpython for example:

http://www.postgresql.org/docs/9.0/static/plpython-sharing.html

Same thing with plperl.

BTW, if you want something that's global but also transactional then you'll want to use a temp table.
--
Jim C. Nasby, Database Architect jim@nasby.net
512.569.9461 (cell) http://jim.nasby.net