Re: [GENERAL] Set DATESTYLE='ISO' (Postgres 6.3.2)

Lists: pgsql-generalpgsql-interfaces
From: "Sangeeta Rao" <Sangeeta_Rao(at)mw(dot)3com(dot)com>
To: pgsql-general(at)postgresql(dot)org, pgsql-interfaces(at)postgresql(dot)org
Subject: Set DATESTYLE='ISO' (Postgres 6.3.2)
Date: 1998-08-24 21:41:12
Message-ID: 8625666A.00731387.00@mwgate02.mw.3com.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general pgsql-interfaces


Hi,

I am using Postgresql 6.3.2 and would like to set the datestyle to be ISO.

Here is what I did:

- issued "set datestyle='ISO' " using PQexec() after opening a connection
with the database. (no errors)
- Then checked the datestyle from psql
dbxxx=> show datestyle ;
response:
NOTICE: DateStyle is Postgres with US (NonEuropean) conventions.
- Also, when I open a jdbc connection with debug tracing on I notice that
the datestyle is Postgres

Why so?? Is this a bug or am I missing something?

Instead of issuing 'set datestyle' command if I set the environment
variable
'PGDATESTYLE' to ISO it works fine but I would like to avoid having to do
this.
What do I need to do to get the sql command 'set datestyle' to work??
I appreciate any help.

Thank You,
SR


From: Aleksey Dashevsky <postgres(at)luckynet(dot)co(dot)il>
To: Sangeeta Rao <Sangeeta_Rao(at)mw(dot)3com(dot)com>
Cc: pgsql-general(at)postgreSQL(dot)org, pgsql-interfaces(at)postgreSQL(dot)org
Subject: Re: [GENERAL] Set DATESTYLE='ISO' (Postgres 6.3.2)
Date: 1998-08-26 07:22:47
Message-ID: Pine.LNX.3.96.SK.980826101241.30103A-100000@kesha.luckynet.co.il
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general pgsql-interfaces


On Mon, 24 Aug 1998, Sangeeta Rao wrote:

>
> Hi,
>
> I am using Postgresql 6.3.2 and would like to set the datestyle to be ISO.
>
> Here is what I did:
>
> - issued "set datestyle='ISO' " using PQexec() after opening a connection
> with the database. (no errors)
> - Then checked the datestyle from psql
> dbxxx=> show datestyle ;
> response:
> NOTICE: DateStyle is Postgres with US (NonEuropean) conventions.
> - Also, when I open a jdbc connection with debug tracing on I notice that
> the datestyle is Postgres
>
> Why so?? Is this a bug or am I missing something?
>
> Instead of issuing 'set datestyle' command if I set the environment
> variable
> 'PGDATESTYLE' to ISO it works fine but I would like to avoid having to do
> this.

Setting datestyle variable has effect only for the session it was issued
in. It was made so to avoid interfernce with another sessions since
they could be started not only by you, but someone else (remember --
PostgreSQL is multiusear). So, the solution is to run postmaster with
"-e" turned on to get the datestyle you need by default-- for details
check manpages postmaster(1) and postgres(1).

Aleksey.


From: Sferacarta Software <sferac(at)bo(dot)nettuno(dot)it>
To: Sangeeta Rao <Sangeeta_Rao(at)mw(dot)3com(dot)com>, Aleksey Dashevsky <postgres(at)luckynet(dot)co(dot)il>, pgsql-general(at)postgresql(dot)org, pgsql-interfaces(at)postgresql(dot)org
Subject: Re[2]: [GENERAL] Set DATESTYLE='ISO' (Postgres 6.3.2)
Date: 1998-08-26 11:27:50
Message-ID: 16560.980826@bo.nettuno.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general pgsql-interfaces

Hello Aleksey,

mercoledì, 26 agosto 98, you wrote:

AD> On Mon, 24 Aug 1998, Sangeeta Rao wrote:

>>
>> Hi,
>>
>> I am using Postgresql 6.3.2 and would like to set the datestyle to be ISO.
>>
>> Here is what I did:
>>
>> - issued "set datestyle='ISO' " using PQexec() after opening a connection
>> with the database. (no errors)
>> - Then checked the datestyle from psql
>> dbxxx=> show datestyle ;
>> response:
>> NOTICE: DateStyle is Postgres with US (NonEuropean) conventions.
>> - Also, when I open a jdbc connection with debug tracing on I notice that
>> the datestyle is Postgres
>>
>> Why so?? Is this a bug or am I missing something?
>>
>> Instead of issuing 'set datestyle' command if I set the environment
>> variable
>> 'PGDATESTYLE' to ISO it works fine but I would like to avoid having to do
>> this.

AD> Setting datestyle variable has effect only for the session it was issued
AD> in. It was made so to avoid interfernce with another sessions since
AD> they could be started not only by you, but someone else (remember --
AD> PostgreSQL is multiusear). So, the solution is to run postmaster with
AD> "-e" turned on to get the datestyle you need by default-- for details
AD> check manpages postmaster(1) and postgres(1).
AD> Aleksey.

The -e option don't allows ISO format, it's a flag to set
European/NoEuropean.

from man postgres(1):

-e The -e option controls how dates are input to and
output from the database.

If the -e option is supplied, then all dates passed
to and from the frontend processes will be assumed to
be in European format ie. DD-MM-YYYY otherwise dates
are input and output in American format ie. MM-DD-
YYYY

To setting date format you can use one of the following:

1. Setting PGDATESTYLE environment variable.

2. Running postmaster using -oe parameter to set format
date to 'European' convention.

3. Changing the following variables:
bool EuroDates = false / true
int DateStyle = USE_ISO_DATES
on ~/src/backend/utils/init/globals.c file before PostgreSQL installation.

Best regards,
Jose' mailto:sferac(at)bo(dot)nettuno(dot)it