DATE type output does not follow datestyle parameter - Mailing list pgsql-hackers

From MauMau
Subject DATE type output does not follow datestyle parameter
Date
Msg-id 6E6F9C9777FC4FAC9ECC6E1348513DD7@maumau
Whole thread Raw
Responses Re: DATE type output does not follow datestyle parameter
List pgsql-hackers
Hello,

The description of datestyle parameter does not seem to match the actual 
behavior.  Is this a bug to be fixed?  Which do you think should be 
corrected, the program or the manual?


The manual says:

DateStyle (string)
Sets the display format for date and time values, as well as the rules for 
interpreting ambiguous date input values. For historical reasons, this 
variable contains two independent components: the output format 
specification (ISO, Postgres, SQL, or German) and the input/output 
specification for year/month/day ordering (DMY, MDY, or YMD). ...


And says:

http://www.postgresql.org/docs/current/static/datatype-datetime.html

8.5.2. Date/Time OutputThe output of the date and time types is of course only the date or time 
part in accordance with the given examples.


After doing "SET datestyle = 'Postgres, MDY'" on the psql prompt, I did the 
following things on the same psql session:


1. SELECT current_timestamp;
              now
----------------------------------Wed Jul 24 10:51:00.217 2013 GMT
(1 行)

This is exactly as I expected.


2. SELECT current_date;
I expected the output "Wed Jul 24 2013" or "Jul 24 2013", but I got:
   date
------------07-24-2013
(1 行)

This does not follow the above statement in 8.5.2.  This output is created 
by EncodeDateOnly() in src/backend/utils/adt/datetime.c.


Regards
MauMau




pgsql-hackers by date:

Previous
From: Fujii Masao
Date:
Subject: Re: Backup throttling
Next
From: Heikki Linnakangas
Date:
Subject: Re: [bug fix] PITR corrupts the database cluster