Re: DATE type output does not follow datestyle parameter

From: Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>
To: MauMau <maumau307(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: DATE type output does not follow datestyle parameter
Date: 2013-07-27 22:35:54
Message-ID: 51F44B4A.6010809@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 07/26/2013 01:24 PM, MauMau wrote:
> From: "Adrian Klaver" <adrian(dot)klaver(at)gmail(dot)com>
>> Actually the relevant code seems to be here:
>>
>> /src/ backend/parser/gram.y
>>
>>
>> CURRENT_DATE
>> {
>> /*
>> * Translate as
>> "'now'::text::date".
>> *
>> ....
>>
>> CURRENT_TIMESTAMP
>> {
>> /*
>> * Translate as "now()", since
>> we have a function that
>> * does exactly what is needed.
>> ...
>>
>>
>> Also from :
>>
>> 8.5.1.4. Special Values
>>
>> The following SQL-compatible functions can also be used to obtain the
>> current time value for the corresponding data type: CURRENT_DATE,
>> CURRENT_TIME, CURRENT_TIMESTAMP, LOCALTIME, LOCALTIMESTAMP. The latter
>> four accept an optional subsecond precision specification. (See Section
>> 9.9.4.) Note that these are SQL functions and are not recognized in data
>> input strings.
>>
>>
>>
>> It would seem the functions are special cased.
>
>
> As below, normal DATE constants also does not follow the setting of
> datestyle. Is this a bug?
>
> SET datestyle = 'Postgres, MDY';
> SELECT DATE 'Jan 2 2013';
> date
> ------------
> 01-02-2013
> (1 row)

I could not tell you. The best I can do is point you at the bug
reporting page:

http://www.postgresql.org/support/submitbug/

>
> Regards
> MauMau
>

--
Adrian Klaver
adrian(dot)klaver(at)gmail(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ben Chobot 2013-07-28 18:02:51 Re: async streaming and recovery_target_timeline=latest
Previous Message John R Pierce 2013-07-27 17:56:40 Re: SQL for multimedia retrieval