Re: Date-Time dangling unit fix

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Date-Time dangling unit fix
Дата
Msg-id 3179735.1678038871@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Date-Time dangling unit fix  (Alexander Lakhin <exclusion@gmail.com>)
Ответы Re: Date-Time dangling unit fix  (Joseph Koshakow <koshy44@gmail.com>)
Список pgsql-hackers
[ I removed Lockhart, because he's taken no part in Postgres work for
  more than twenty years; if that address even still works, you're
  just bugging him ]

Alexander Lakhin <exclusion@gmail.com> writes:
> In fact,
> SELECT time 'h04mm05s06';
> doesn't work for many years, but
> SELECT time 'h04mm05s06.0';
> still does.

I traced that down to this in DecodeTimeOnly:

    if ((fmask & DTK_TIME_M) != DTK_TIME_M)
        return DTERR_BAD_FORMAT;

where we have

#define DTK_ALL_SECS_M    (DTK_M(SECOND) | DTK_M(MILLISECOND) | DTK_M(MICROSECOND))
#define DTK_TIME_M    (DTK_M(HOUR) | DTK_M(MINUTE) | DTK_ALL_SECS_M)

So in other words, this test insists on seeing hour, minute, second,
*and* fractional-second fields.  That seems obviously too picky.
It might not matter if we rip out this syntax, but I see other similar
tests so I suspect some of them will still be reachable.

Personally I'd say that hh:mm is a plenty complete enough time, and
whether you write seconds is optional, let alone fractional seconds.
We do accept this:

=> select '12:34'::time;
   time
----------
 12:34:00
(1 row)

so that must be going through a different code path, which I didn't
try to identify yet.

            regards, tom lane



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

Предыдущее
От: Justin Pryzby
Дата:
Сообщение: Re: zstd compression for pg_dump
Следующее
От: Ankit Kumar Pandey
Дата:
Сообщение: Re: [Question] Similar Cost but variable execution time in sort