DATE type output does not follow datestyle parameter

Поиск
Список
Период
Сортировка
От MauMau
Тема DATE type output does not follow datestyle parameter
Дата
Msg-id 3157168929514D1291BBE83AFE2AE711@maumau
обсуждение исходный текст
Ответы Re: DATE type output does not follow datestyle parameter  (Adrian Klaver <adrian.klaver@gmail.com>)
Список pgsql-general
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.


Regards
MauMau




В списке pgsql-general по дате отправления:

Предыдущее
От: amulsul
Дата:
Сообщение: Re: How to do incremental / differential backup every hour in Postgres 9.1?
Следующее
От: Loïc Rollus
Дата:
Сообщение: Trigger and deadlock