Thread: session variable

session variable

From
sad
Date:
Good day

is it possible to define user variables in session ?
If not then is it planned to implement ?
or it is principially impossible in PosqtgreSQL

Re: session variable

From
Bruce Momjian
Date:
sad wrote:
> Good day
>
> is it possible to define user variables in session ?
> If not then is it planned to implement ?
> or it is principially impossible in PosqtgreSQL

psql has variables, but in general we don't support session varibles.
You could create a temp table and put a value in there easily.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: session variable

From
sad
Date:
On Monday 01 September 2003 20:57, you wrote:
> sad wrote:
> > Good day
> >
> > is it possible to define user variables in session ?
> > If not then is it planned to implement ?
> > or it is principially impossible in PosqtgreSQL
>
> psql has variables, but in general we don't support session varibles.
> You could create a temp table and put a value in there easily.

that's ok, unless i need to access it in a trigger.

where may i ask a programming and perfomance question?
i think mailing such questions to "BUGS" is not a good idea.=20

Re: session variable

From
Andreas Pflug
Date:
sad wrote:

>>>is it possible to define user variables in session ?
>>>If not then is it planned to implement ?
>>>or it is principially impossible in PosqtgreSQL
>>>
>>>
>>psql has variables, but in general we don't support session varibles.
>>You could create a temp table and put a value in there easily.
>>
>>
>
>that's ok, unless i need to access it in a trigger.
>
No problem to use  a temp table in a trigger (which is local to the
session), I do so myself. Still, session variables would be nice, making
coding a little bit more comfortable.

>
>where may i ask a programming and perfomance question?
>i think mailing such questions to "BUGS" is not a good idea.
>
Just use the pgsql-sql and pgsql-performance mailing lists.


Regards,
Andreas

Re: session variable

From
"Bupp Phillips"
Date:
Could you possible have some type of  variable (preferably the Transaction
ID) that can identify an individual process?

If something like this already exist, then disregard this post.

"Bruce Momjian" <pgman@candle.pha.pa.us> wrote in message
news:200309011657.h81Gva817128@candle.pha.pa.us...
> sad wrote:
> > Good day
> >
> > is it possible to define user variables in session ?
> > If not then is it planned to implement ?
> > or it is principially impossible in PosqtgreSQL
>
> psql has variables, but in general we don't support session varibles.
> You could create a temp table and put a value in there easily.
>
> --
>   Bruce Momjian                        |  http://candle.pha.pa.us
>   pgman@candle.pha.pa.us               |  (610) 359-1001
>   +  If your life is a hard drive,     |  13 Roberts Road
>   +  Christ can be your backup.        |  Newtown Square, Pennsylvania
19073
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>

Re: session variable

From
Andreas Pflug
Date:
Bupp Phillips wrote:

>Could you possible have some type of  variable (preferably the Transaction
>ID) that can identify an individual process?
>

There's pg_backend_pid() for 7.4 and backend_pid() as contrib module for
earlier releases.

Regards,
Andreas

Re: session variable

From
Bruce Momjian
Date:
sad wrote:
> On Monday 01 September 2003 20:57, you wrote:
> > sad wrote:
> > > Good day
> > >
> > > is it possible to define user variables in session ?
> > > If not then is it planned to implement ?
> > > or it is principially impossible in PosqtgreSQL
> >
> > psql has variables, but in general we don't support session varibles.
> > You could create a temp table and put a value in there easily.
>
> that's ok, unless i need to access it in a trigger.

Why can't you grab it out of the temp table from the trigger?

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073