Re: [SQL] external environment variable

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Randal Flagg" <flagg_randal(at)hotmail(dot)com>
Cc: pgsql-sql(at)hub(dot)org
Subject: Re: [SQL] external environment variable
Date: 1999-04-15 14:54:26
Message-ID: 11045.924188066@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

"Randal Flagg" <flagg_randal(at)hotmail(dot)com> writes:
> I've a little problem. I've installed Apache JServ 1.03b and it
> works very good, I've also installed PostreSQL 6.4 and I set the
> environment variable PGDATESTYLE in the /etc/profile file. When I use
> PostgreSQL directly, date's fields are shown according to the
> PGDATESTYLE but, when I query a table across the Web using a Servlet
> PostreSQL ignore PGDATESTYLE and use it's default.

You didn't give any details about how the servlet is constructed,
but for anything based on libpq, the PGDATESTYLE setting at the client
is what matters, not the setting in the server machine's environment.
(libpq automatically issues SET commands for datestyle and a couple of
other variables during connection startup, using whatever values it
finds in its environment variables.)

In particular, setting /etc/profile isn't making things work the way
you want on the server machine because of putting PGDATESTYLE into
the postmaster/backend environment. Rather, it's affecting the *client*
environment in which psql or other client apps run, and that setting
is getting transmitted to the backend process.

So, either set up the environment values you want for the client servlet,
or issue the desired SET commands "by hand" within the servlet.

regards, tom lane

Browse pgsql-sql by date

  From Date Subject
Next Message Dan Janowski 1999-04-15 18:21:41 [SQL] OUTER JOINS
Previous Message José Soares 1999-04-14 13:40:33 Re: [SQL] external environment variable