Re: Question on cast string to date

From: 正华吕 <kainwen(at)gmail(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Question on cast string to date
Date: 2022-05-10 05:47:07
Message-ID: CANerzAd2Rop1_QLW5FLBLu7OMcEtuB9JR2BX4Bm2XQYcxDHGgg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thanks all.

David G. Johnston <david(dot)g(dot)johnston(at)gmail(dot)com> 于2022年5月10日周二 13:41写道:

> On Monday, May 9, 2022, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
>> =?UTF-8?B?5q2j5Y2O5ZCV?= <kainwen(at)gmail(dot)com> writes:
>> > I test the following SQL in pg15dev (seems same behavior as the
>> > previous version).
>> > select '2020701'::date;
>> > date
>> > ------------
>> > 0202-07-01
>> > (1 row)
>> > At the first glance, the result seems quite strange.
>>
>> [ shrug... ] You left out a zero. It's not apparent to me that
>> this answer is wrong.
>
>
>> If you want to pursue this question, you could start by bisecting
>> to find just which commit changed it and why.
>>
>>
> Manual history inspection of datetime.c
>
>
> https://github.com/postgres/postgres/commit/7778ddc7a2d5b006edbfa69cdb44b8d8c24ec1ff
>
>
> https://www.postgresql.org/message-id/flat/8977CB36860C5843884E0A18D8747B0372BC6401%40szxeml558-mbs.china.huawei.com#8aa7c8b8916056a53f6c6dff0f0eb428
>
> The goal seemed to be able to accept 5-digit years…this behavior change
> didn’t show in the tests (or discussion) though I didn’t look for the of
> testing the pre-existing failure mode.
>
> David J.
>
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2022-05-10 06:03:59 Re: Question on cast string to date
Previous Message David G. Johnston 2022-05-10 05:40:58 Re: Question on cast string to date