Re: [SQL] external environment variable - Mailing list pgsql-sql

From Tom Lane
Subject Re: [SQL] external environment variable
Date
Msg-id 11045.924188066@sss.pgh.pa.us
Whole thread Raw
List pgsql-sql
"Randal Flagg" <flagg_randal@hotmail.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


pgsql-sql by date:

Previous
From: José Soares
Date:
Subject: Re: [SQL] external environment variable
Next
From: Dan Janowski
Date:
Subject: [SQL] OUTER JOINS