pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix input of ISO "extended" time format for types time and timet
2+ messages / 1 participants
[nested] [flat]

* pgsql: Fix input of ISO "extended" time format for types time and timet
@ 2024-05-22 22:23 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2024-05-22 22:23 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix input of ISO "extended" time format for types time and timetz.

Commit 3e1a373e2 missed teaching DecodeTimeOnly the same "ptype"
manipulations it added to DecodeDateTime.  While likely harmless
at the time, it became a problem after 5b3c59535 added an error check
that ptype must be zero once we exit the parsing loop (that is, there
shouldn't be any unused prefixes).  The consequence was that we'd
reject time or timetz input like T12:34:56 (the "extended" format
per ISO 8601-1:2019), even though that still worked in timestamp
input.

Since this is clearly under-tested code, add test cases covering all
the ISO 8601 time formats.  (Note: although 8601 allows just "Thh",
we have never accepted that, and this patch doesn't change that.
I'm content to leave that as-is because it seems too likely to be
a mistake rather than intended input.  If anyone wants to allow
that, it should be a separate patch anyway, and not back-patched.)

Per bug #18470 from David Perez.  Back-patch to v16 where we
broke it.

Discussion: https://postgr.es/m/18470-34fad4c829106848@postgresql.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/a9a7c2c3e15ede7a4f6b44d72a32b105b9113f02

Modified Files
--------------
src/backend/utils/adt/datetime.c       |  11 +++
src/test/regress/expected/horology.out | 155 +++++++++++++++++++++++++++++++++
src/test/regress/sql/horology.sql      |  29 ++++++
3 files changed, 195 insertions(+)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: Fix input of ISO "extended" time format for types time and timet
@ 2024-05-22 22:23 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2024-05-22 22:23 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix input of ISO "extended" time format for types time and timetz.

Commit 3e1a373e2 missed teaching DecodeTimeOnly the same "ptype"
manipulations it added to DecodeDateTime.  While likely harmless
at the time, it became a problem after 5b3c59535 added an error check
that ptype must be zero once we exit the parsing loop (that is, there
shouldn't be any unused prefixes).  The consequence was that we'd
reject time or timetz input like T12:34:56 (the "extended" format
per ISO 8601-1:2019), even though that still worked in timestamp
input.

Since this is clearly under-tested code, add test cases covering all
the ISO 8601 time formats.  (Note: although 8601 allows just "Thh",
we have never accepted that, and this patch doesn't change that.
I'm content to leave that as-is because it seems too likely to be
a mistake rather than intended input.  If anyone wants to allow
that, it should be a separate patch anyway, and not back-patched.)

Per bug #18470 from David Perez.  Back-patch to v16 where we
broke it.

Discussion: https://postgr.es/m/18470-34fad4c829106848@postgresql.org

Branch
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/019ea7675c7722ff7f9016b878feea8e7faac608

Modified Files
--------------
src/backend/utils/adt/datetime.c       |  11 +++
src/test/regress/expected/horology.out | 155 +++++++++++++++++++++++++++++++++
src/test/regress/sql/horology.sql      |  29 ++++++
3 files changed, 195 insertions(+)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2024-05-22 22:23 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-05-22 22:23 pgsql: Fix input of ISO "extended" time format for types time and timet Tom Lane <tgl@sss.pgh.pa.us>
2024-05-22 22:23 pgsql: Fix input of ISO "extended" time format for types time and timet Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox