Re: Document DateStyle effect on jsonpath string()

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: "David E. Wheeler" <david@justatheory.com>
Cc: Andrew Dunstan <andrew@dunslane.net>, Peter Eisentraut <peter@eisentraut.org>, jian he <jian.universality@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2024-09-11T19:08:35Z
Lists: pgsql-hackers

Attachments

"David E. Wheeler" <david@justatheory.com> writes:
> On Sep 11, 2024, at 12:26, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Building on that thought, maybe we could fix it as attached?

> It looks like that’s what datum_to_json_internal() in json.c does, which IIUC is the default stringification for date and time values.

Right.  I actually lifted the code from convertJsonbScalar in
jsonb_util.c.

Here's a more fleshed-out patch with docs and regression test
fixes.  I figured we could shorten the tests a bit now that
the point is just to verify that datestyle *doesn't* affect it.

			regards, tom lane

Commits

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

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