From: | Steve Crawford <scrawford(at)pinpointresearch(dot)com> |
---|---|
To: | Alex Ignatov <a(dot)ignatov(at)postgrespro(dot)ru> |
Cc: | Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>, "Tom Lane *EXTERN*" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, amul sul <sul_amul(at)yahoo(dot)co(dot)in>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Bug in to_timestamp(). |
Date: | 2016-06-24 16:26:21 |
Message-ID: | CAEfWYywsvT1_PV7pFJhJZJ03R3DmgqgDaCjHpXJdCHSfCMY6fw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
My observation has been that the PostgreSQL development group aims for
correctness and the elimination of surprising results. This was part of the
reason to eliminate a number of automatic casts to dates in earlier
versions.
To me, 2016-02-30 is an invalid date that should generate an error.
Automatically and silently changing it to be 2016-03-01 strikes me as a
behavior I'd expect from a certain other open-source database, not
PostgreSQL.
Cheers,
Steve
On Fri, Jun 24, 2016 at 8:52 AM, Alex Ignatov <a(dot)ignatov(at)postgrespro(dot)ru>
wrote:
>
> Alex Ignatov
> Postgres Professional: http://www.postgrespro.com
> The Russian Postgres Company
>
> On 20.06.2016 17:09, Albe Laurenz wrote:
>
>> Tom Lane wrote:
>>
>>> I don't necessarily have an opinion yet. I would like to see more than
>>> just an unsupported assertion about what Oracle's behavior is. Also,
>>> how should FM mode affect this?
>>>
>> I can supply what Oracle 12.1 does:
>>
>> SQL> SELECT to_timestamp('2016-06-13 15:43:36', ' YYYY/MM/DD HH24:MI:SS')
>> AS ts FROM dual;
>>
>> TS
>> --------------------------------
>> 2016-06-13 15:43:36.000000000 AD
>>
>> SQL> SELECT to_timestamp('2016-06-13 15:43:36', 'YYYY/MM/DD HH24:MI:SS')
>> AS ts FROM dual;
>>
>> TS
>> --------------------------------
>> 2016-06-13 15:43:36.000000000 AD
>>
>> SQL> SELECT to_timestamp('2016-06-13 15:43:36', 'YYYY/MM/DD
>> HH24:MI:SS') AS ts FROM dual;
>>
>> TS
>> --------------------------------
>> 2016-06-13 15:43:36.000000000 AD
>>
>> (to_timestamp_tz behaves the same way.)
>>
>> So Oracle seems to make no difference between one or more spaces.
>>
>> Yours,
>> Laurenz Albe
>>
>> Guys, do we need to change this behavior or may be you can tell me that
> is normal because this and this:
>
> postgres=# SELECT TO_TIMESTAMP('2016-02-30 15:43:36', 'YYYY-MM-DD
> HH24:MI:SS');
> to_timestamp
> ------------------------
> 2016-03-01 15:43:36+03
> (1 row)
>
> but on the other side we have :
>
> postgres=# select '2016-02-30 15:43:36'::timestamp;
> ERROR: date/time field value out of range: "2016-02-30 15:43:36"
> LINE 1: select '2016-02-30 15:43:36'::timestamp;
>
> Another bug in to_timestamp/date()?
>
>
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>
From | Date | Subject | |
---|---|---|---|
Next Message | Joshua D. Drake | 2016-06-24 17:08:47 | Re: Odd behavior with domains |
Previous Message | Alex Ignatov | 2016-06-24 15:52:34 | Re: Bug in to_timestamp(). |