Re: Document DateStyle effect on jsonpath string()
От | David E. Wheeler |
---|---|
Тема | Re: Document DateStyle effect on jsonpath string() |
Дата | |
Msg-id | E443FB23-3BEE-448D-95E4-F10904A10E5D@justatheory.com обсуждение исходный текст |
Ответ на | Re: Document DateStyle effect on jsonpath string() (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: Document DateStyle effect on jsonpath string()
|
Список | pgsql-hackers |
On Sep 11, 2024, at 10:11, Tom Lane <tgl@sss.pgh.pa.us> wrote: > [ 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) I wonder, then, whether .string() should be modified to use the ISO format in UTC, and therefore be immutable. That’s theformat you get if you omit .string() and let result be stringified from a date/time/timestamp. FWIW, that’s how my Go port works, since I didn’t bother to replicate the DateStyle GUC (example[1]). Best, David [1]: https://theory.github.io/sqljson/playground/?p=%2524.timestamp%28%29.string%28%29&j=%25222023-08-15%252012%253A34%253A56%2522&a=&o=1
В списке pgsql-hackers по дате отправления: