Document DateStyle effect on jsonpath string()

David E. Wheeler <david@justatheory.com>

From: "David E. Wheeler" <david@justatheory.com>
To: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2024-07-02T16:51:19Z
Lists: pgsql-hackers

Attachments

Hackers,

In fuzing around trying to work out what’s going on with the formatting of timestamptz values cast by the timestamp_tz() jsonpath method[1], I noticed that the formatting of the string() method applied to date and time objects was not fully tested, or how the output is determined by the DateStyle method.

The attached path aims to rectify this situation by adding tests that chain string() after the jsonpath date/time methods, both with the default testing “PostreSQL” DateStyle and “ISO”. It also mentions the impact of the DateStyle parameter in the string() documentation.

Also available to review as a pull request[2].

Best,

David

[1]: https://www.postgresql.org/message-id/7DE080CE-6D8C-4794-9BD1-7D9699172FAB%40justatheory.com
[2]: https://github.com/theory/postgres/pull/7/files

Commits

  1. Make jsonpath .string() be immutable for datetimes.

  2. Improve documentation and testing of jsonpath string() for datetimes.