Re: user defined variables

Поиск
Список
Период
Сортировка
Искать

Re: user defined variables

От:
"Joel Burton" <joel@joelburton.com>
Дата:
> -----Original Message-----
> From: pgsql-general-owner@postgresql.org
> [mailto:pgsql-general-owner@postgresql.org]On Behalf Of Moritz Sinn
> Sent: Friday, May 24, 2002 11:21 AM
> To: Nigel J. Andrews
> Cc: pgsql-general@postgresql.org
> Subject: Re: [GENERAL] user defined variables
>
>
> "Nigel J. Andrews"  writes:
>
> > On 24 May 2002, Moritz Sinn wrote:
> > >
> > > hi,
> > >
> > > isn't it possible to define own environment vars?
> > >
> >
> > Did I miss something?
> >
> > I'd answer with:
> >
> > 	Errrrr.......yeeeeees.
> >
> > Except I've got this distinct feeling I must have missed something.
> >
> > What is it you're trying to achieve other than setting
> environment variables
> > which is shell specific?
>
> well, i mean i want to make a value available under a certain name, for
> the whole db session.
> i want to do something like "UID=4545323667424;" and then be able to say
> "SELECT * FROM USER WHERE uid=UID;"
>
> But SET only accepts predefined environment variables.

In the psql client, you can set a variable with the "\set" command, or using
"--set" at startup. So "psql --set UID=xxxx" will let you use the the UID as
"SELECT * FROM USER WHERE uid= :UID".

Will this work for you?

- J.

Joel BURTON | joel@joelburton.com | joelburton.com | aim: wjoelburton
Knowledge Management & Technology Consultant

Re: user defined variables

От:
Moritz Sinn <moritz@freesources.org>
Дата:
"Joel Burton"  writes:


 
> In the psql client, you can set a variable with the "\set" command, or using
> "--set" at startup. So "psql --set UID=xxxx" will let you use the the UID as
> "SELECT * FROM USER WHERE uid= :UID".
> 
> Will this work for you?
> 
> - J.

well, i'm using the php functions for communicating with postgresql. but
this means that it is possible.
has someone an idea how i can set such a variable when i open the
connection with php?

thanks,
 moritz

-- 
 seen jhm
 jhm is Sarek, and jhm is on the channel right now!
* JHM wonders why dpkg remembers that particular nick.
 dpkg: Sarek? ermm, sure, and I am Khan
	-- Seen on #Debian

Re: user defined variables

От:
Moritz Sinn <moritz@freesources.org>
Дата:
"Nigel J. Andrews"  writes:

> On 24 May 2002, Moritz Sinn wrote:
> > 
> > hi,
> > 
> > isn't it possible to define own environment vars?
> >
> 
> Did I miss something?
> 
> I'd answer with:
> 
> 	Errrrr.......yeeeeees.
> 
> Except I've got this distinct feeling I must have missed something.
> 
> What is it you're trying to achieve other than setting environment variables
> which is shell specific?

well, i mean i want to make a value available under a certain name, for
the whole db session.
i want to do something like "UID=4545323667424;" and then be able to say
"SELECT * FROM USER WHERE uid=UID;"

But SET only accepts predefined environment variables.

thanks,

 moritz


-- 
#define FALSE   0               /* This is the naked Truth */
#define TRUE    1               /* and this is the Light */
	-- mailto.c

user defined variables

От:
Moritz Sinn <moritz@freesources.org>
Дата:

hi,

isn't it possible to define own environment vars?

thanks,
  moritz

-- 
/*
 * Oops. The kernel tried to access some bad page. We'll have to
 * terminate things with extreme prejudice.
*/
die_if_kernel("Oops", regs, error_code);
	-- From linux/arch/i386/mm/fault.c

Re: user defined variables

От:
"Nigel J. Andrews" <nandrews@investsystems.co.uk>
Дата:

On 24 May 2002, Moritz Sinn wrote:
> 
> hi,
> 
> isn't it possible to define own environment vars?
>

Did I miss something?

I'd answer with:

	Errrrr.......yeeeeees.

Except I've got this distinct feeling I must have missed something.

What is it you're trying to achieve other than setting environment variables
which is shell specific?


-- 
Nigel J. Andrews
Director

---
Logictree Systems Limited
Computer Consultants

FAQ