Обсуждение: environment variables

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

environment variables

От
"Walker, Jed S"
Дата:
I've noticed postgres uses some environment variables such as $PGDATA. Is
there a standard postgres environment variable for the current database?

I'd like something where we can have aliases and such access the db without
the user having to know what the name is

alias sql='psql -d $PGDATABASE'

type thing.

Thanks,


        Jed S. Walker
        Senior Database Administrator
        Comcast Media Centers
        Phone:    303.267.6759
        Email:     jed_walker@cable.comcast.com

        CONFIDENTIAL NOTICE
        This electronic mail transmission and any accompanying
documents contain information belonging to the sender, which may be
confidential and legally privileged.  If you are not the intended recipient,
any disclosure, copying, distribution or action taken in reliance on the
message is strictly prohibited.  If you have received this message in error,
please delete it immediately. Thank You






Re: environment variables

От
Michael Fuhr
Дата:
On Thu, Mar 17, 2005 at 12:57:16PM -0700, Walker, Jed S wrote:

> I've noticed postgres uses some environment variables such as $PGDATA. Is
> there a standard postgres environment variable for the current database?
>
> I'd like something where we can have aliases and such access the db without
> the user having to know what the name is
>
> alias sql='psql -d $PGDATABASE'

PGDATABASE should work.  Did you try setting it as an environment
variable?  That is, using "export" or "setenv", depending on what
shell you're using?

See "Environment" in the psql documentation and "Environment
Variables" in the libpq documentation.  Here are links to doc for
the latest release:

http://www.postgresql.org/docs/8.0/interactive/app-psql.html
http://www.postgresql.org/docs/8.0/interactive/libpq-envars.html

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

Re: environment variables

От
Tom Lane
Дата:
"Walker, Jed S" <Jed_Walker@cable.comcast.com> writes:
> I've noticed postgres uses some environment variables such as $PGDATA. Is
> there a standard postgres environment variable for the current database?

See
http://www.postgresql.org/docs/8.0/static/libpq-envars.html

            regards, tom lane