pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tim Field <tim@mohiohio.com>
To: pgsql-bugs@lists.postgresql.org
Subject: Comparing date strings with jsonpath expression
Date: Fri, 26 May 2023 13:36:14 +1200
Message-ID: <014A028B-5CE6-4FDF-AC24-426CA6FC9CEE@mohiohio.com> (raw)

When using .datetime() in jsonpath expressions JSON encoded dates are not parsed, this is coupled with the fact that an error isn’t reported.

I would expect that any date encoded via JSON.stringify() would be parseable in these JSON path functions as that is after all the format that dates are very likely to be in.

If I JSON encode a date I get a value such as "2023-05-22T03:09:37.825Z” .datetime() fails to parse this due to the mircosends and timezone indicator, yet its possible to convert that with 
"2023-05-22T03:09:37.825Z”::timestamptz 

Example here of the issue, and a stackoverflow post with further discussion.


https://dbfiddle.uk/PzW0WOvV

https://stackoverflow.com/questions/76319993/comparing-date-strings-with-jsonpath-expression
Comparing date strings with jsonpath expression
stackoverflow.com=

Attachments:

apple-touch-icon@2.png (image/png, 6.4K) download view image

view thread (4+ messages)  latest in thread

Message-ID: <014A028B-5CE6-4FDF-AC24-426CA6FC9CEE@mohiohio.com>
Permalink:  ../014A028B-5CE6-4FDF-AC24-426CA6FC9CEE@mohiohio.com/
Also on:    postgresql.org/message-id/014A028B-5CE6-4FDF-AC24-426CA6FC9CEE@mohiohio.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tim@mohiohio.com
  Subject: Re: Comparing date strings with jsonpath expression
  In-Reply-To: <014A028B-5CE6-4FDF-AC24-426CA6FC9CEE@mohiohio.com>
  References: <014A028B-5CE6-4FDF-AC24-426CA6FC9CEE@mohiohio.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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