Re: Date-Time dangling unit fix
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alexander Lakhin <exclusion@gmail.com>
Cc: Joseph Koshakow <koshy44@gmail.com>,
PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2023-03-05T17:54:31Z
Lists: 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
Commits
-
Tighten error checks in datetime input, and remove bogus "ISO" format.
- 5b3c5953553b 16.0 landed
-
Measure the current transaction time to milliseconds.
- 6f58115dddfa 7.2.1 cited