Re: Document DateStyle effect on jsonpath string()
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Peter Eisentraut <peter@eisentraut.org>
Cc: "David E. Wheeler" <david@justatheory.com>,
jian he <jian.universality@gmail.com>,
PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2024-09-11T14:11:05Z
Lists: pgsql-hackers
Peter Eisentraut <peter@eisentraut.org> writes:
> What I'm concerned about is that this makes the behavior of JSON_QUERY
> non-immutable. Maybe there are other reasons for it to be
> non-immutable, in which case this isn't important. But it might be
> worth avoiding that?
Fair point, but haven't we already bit that bullet with respect
to timezones?
[ looks... ] Hmm, it looks like jsonb_path_exists_tz is marked
stable while jsonb_path_exists is claimed to be immutable.
So yeah, there's a problem here. I'm not 100% convinced that
jsonb_path_exists was truly immutable before, but for sure it
is not now, and that's bad.
regression=# select jsonb_path_query('"2023-08-15 12:34:56"', '$.timestamp().string()');
jsonb_path_query
-----------------------
"2023-08-15 12:34:56"
(1 row)
regression=# set datestyle = postgres;
SET
regression=# select jsonb_path_query('"2023-08-15 12:34:56"', '$.timestamp().string()');
jsonb_path_query
----------------------------
"Tue Aug 15 12:34:56 2023"
(1 row)
regards, tom lane
Commits
-
Make jsonpath .string() be immutable for datetimes.
- cc4fdfa411fa 17.0 landed
- cb599b9ddfcc 18.0 landed
-
Improve documentation and testing of jsonpath string() for datetimes.
- ed055d249df5 18.0 landed