On Wed, Jul 24, 2013 at 09:06:30PM +0900, MauMau wrote:
> 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 Output
> The 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.
Yes, you are correct, this is inconsistent. Let me look at writing a
patch to fix this. Is this format so old that we can't fix this?
-- Bruce Momjian <bruce@momjian.us> http://momjian.us EnterpriseDB
http://enterprisedb.com
+ It's impossible for everything to be true. +