pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Accept fractional seconds in jsonpath's datetime() method.
4+ messages / 1 participants
[nested] [flat]

* pgsql: Accept fractional seconds in jsonpath's datetime() method.
@ 2023-06-12 14:54 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 4+ messages in thread

From: Tom Lane @ 2023-06-12 14:54 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Accept fractional seconds in jsonpath's datetime() method.

Commit 927d9abb6 purported to make datetime() accept any string
that could be output for a datetime value by to_jsonb().  But it
overlooked the possibility of fractional seconds being present,
so that cases as simple as to_jsonb(now()) would defeat it.

Fix by adding formats that include ".US" to the list in
executeDateTimeMethod().  (Note that while this is nominally
microseconds, it'll do the right thing for fractions with
fewer than six digits.)

In passing, re-order the list to restore the datatype ordering
specified in its comment.  The violation accidentally did not
break anything; but the next edit might be less lucky, so add
more comments.

Per report from Tim Field.  Back-patch to v13 where datetime()
was added, like the previous patch.

Discussion: https://postgr.es/m/014A028B-5CE6-4FDF-AC24-426CA6FC9CEE@mohiohio.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/7398e27224f173306e5b62977672b29f5553ee76

Modified Files
--------------
src/backend/utils/adt/jsonpath_exec.c        | 17 +++++++++++++----
src/test/regress/expected/jsonb_jsonpath.out | 15 +++++++++++++++
src/test/regress/sql/jsonb_jsonpath.sql      |  3 +++
3 files changed, 31 insertions(+), 4 deletions(-)



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

* pgsql: Accept fractional seconds in jsonpath's datetime() method.
@ 2023-06-12 14:54 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 4+ messages in thread

From: Tom Lane @ 2023-06-12 14:54 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Accept fractional seconds in jsonpath's datetime() method.

Commit 927d9abb6 purported to make datetime() accept any string
that could be output for a datetime value by to_jsonb().  But it
overlooked the possibility of fractional seconds being present,
so that cases as simple as to_jsonb(now()) would defeat it.

Fix by adding formats that include ".US" to the list in
executeDateTimeMethod().  (Note that while this is nominally
microseconds, it'll do the right thing for fractions with
fewer than six digits.)

In passing, re-order the list to restore the datatype ordering
specified in its comment.  The violation accidentally did not
break anything; but the next edit might be less lucky, so add
more comments.

Per report from Tim Field.  Back-patch to v13 where datetime()
was added, like the previous patch.

Discussion: https://postgr.es/m/014A028B-5CE6-4FDF-AC24-426CA6FC9CEE@mohiohio.com

Branch
------
REL_15_STABLE

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

Modified Files
--------------
src/backend/utils/adt/jsonpath_exec.c        | 17 +++++++++++++----
src/test/regress/expected/jsonb_jsonpath.out | 15 +++++++++++++++
src/test/regress/sql/jsonb_jsonpath.sql      |  3 +++
3 files changed, 31 insertions(+), 4 deletions(-)



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

* pgsql: Accept fractional seconds in jsonpath's datetime() method.
@ 2023-06-12 14:54 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 4+ messages in thread

From: Tom Lane @ 2023-06-12 14:54 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Accept fractional seconds in jsonpath's datetime() method.

Commit 927d9abb6 purported to make datetime() accept any string
that could be output for a datetime value by to_jsonb().  But it
overlooked the possibility of fractional seconds being present,
so that cases as simple as to_jsonb(now()) would defeat it.

Fix by adding formats that include ".US" to the list in
executeDateTimeMethod().  (Note that while this is nominally
microseconds, it'll do the right thing for fractions with
fewer than six digits.)

In passing, re-order the list to restore the datatype ordering
specified in its comment.  The violation accidentally did not
break anything; but the next edit might be less lucky, so add
more comments.

Per report from Tim Field.  Back-patch to v13 where datetime()
was added, like the previous patch.

Discussion: https://postgr.es/m/014A028B-5CE6-4FDF-AC24-426CA6FC9CEE@mohiohio.com

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/5eaa05f637179b6847f9efc98ca07a9aa1479e47

Modified Files
--------------
src/backend/utils/adt/jsonpath_exec.c        | 17 +++++++++++++----
src/test/regress/expected/jsonb_jsonpath.out | 15 +++++++++++++++
src/test/regress/sql/jsonb_jsonpath.sql      |  3 +++
3 files changed, 31 insertions(+), 4 deletions(-)



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

* pgsql: Accept fractional seconds in jsonpath's datetime() method.
@ 2023-06-12 14:54 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 4+ messages in thread

From: Tom Lane @ 2023-06-12 14:54 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Accept fractional seconds in jsonpath's datetime() method.

Commit 927d9abb6 purported to make datetime() accept any string
that could be output for a datetime value by to_jsonb().  But it
overlooked the possibility of fractional seconds being present,
so that cases as simple as to_jsonb(now()) would defeat it.

Fix by adding formats that include ".US" to the list in
executeDateTimeMethod().  (Note that while this is nominally
microseconds, it'll do the right thing for fractions with
fewer than six digits.)

In passing, re-order the list to restore the datatype ordering
specified in its comment.  The violation accidentally did not
break anything; but the next edit might be less lucky, so add
more comments.

Per report from Tim Field.  Back-patch to v13 where datetime()
was added, like the previous patch.

Discussion: https://postgr.es/m/014A028B-5CE6-4FDF-AC24-426CA6FC9CEE@mohiohio.com

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/6f23b5f74f5fd86d7bbadc89359b8f2175665400

Modified Files
--------------
src/backend/utils/adt/jsonpath_exec.c        | 17 +++++++++++++----
src/test/regress/expected/jsonb_jsonpath.out | 15 +++++++++++++++
src/test/regress/sql/jsonb_jsonpath.sql      |  3 +++
3 files changed, 31 insertions(+), 4 deletions(-)



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


end of thread, other threads:[~2023-06-12 14:54 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-06-12 14:54 pgsql: Accept fractional seconds in jsonpath's datetime() method. Tom Lane <tgl@sss.pgh.pa.us>
2023-06-12 14:54 pgsql: Accept fractional seconds in jsonpath's datetime() method. Tom Lane <tgl@sss.pgh.pa.us>
2023-06-12 14:54 pgsql: Accept fractional seconds in jsonpath's datetime() method. Tom Lane <tgl@sss.pgh.pa.us>
2023-06-12 14:54 pgsql: Accept fractional seconds in jsonpath's datetime() method. 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