Question on cast string to date

Поиск
Список
Период
Сортировка
От 正华吕
Тема Question on cast string to date
Дата
Msg-id CANerzAcbEw0Uvv9APGK4FORGbeJ0ftwtuG6=kNgA_P0NTxa9ew@mail.gmail.com
обсуждение исходный текст
Ответы Re: Question on cast string to date
Re: Question on cast string to date
Re: Question on cast string to date
Список pgsql-general
Hi,

    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.

   Go through the code, postgres use date_in to do the cast, and firstly use last 2 chars to
   get the day, and the 2 chars to get the month, and all remaining chars as year.

   The question here is: should we throw error for such input? Or what standard postgres is
   using to cast such kind of string?

Thanks.

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

Предыдущее
От: Bharath Rupireddy
Дата:
Сообщение: Re: Set timeout just on a query?
Следующее
От: Pavel Stehule
Дата:
Сообщение: Re: Question on cast string to date