Re: user defined variables

Поиск
Список
Период
Сортировка
От Joel Burton
Тема Re: user defined variables
Дата
Msg-id JGEPJNMCKODMDHGOBKDNKEHCCPAA.joel@joelburton.com
обсуждение исходный текст
Ответ на Re: user defined variables  (Moritz Sinn <moritz@freesources.org>)
Ответы Re: user defined variables  (Moritz Sinn <moritz@freesources.org>)
Список pgsql-general
> -----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" <nandrews@investsystems.co.uk> 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


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

Предыдущее
От: Moritz Sinn
Дата:
Сообщение: Re: user defined variables
Следующее
От: "Olonichev Sergei"
Дата:
Сообщение: Re: How to add big amounts of data into database?