Re: More new SQL/JSON item methods - Mailing list pgsql-hackers

From jian he
Subject Re: More new SQL/JSON item methods
Date
Msg-id CACJufxGc4nRh1iAOf93LfuzcQPDEJQatvALOiAHZpLEXQ+1JAg@mail.gmail.com
Whole thread Raw
In response to Re: More new SQL/JSON item methods  (Peter Eisentraut <peter@eisentraut.org>)
Responses Re: More new SQL/JSON item methods
List pgsql-hackers
On Fri, Oct 6, 2023 at 7:47 PM Peter Eisentraut <peter@eisentraut.org> wrote:
>
> On 29.08.23 09:05, Jeevan Chalke wrote:
> > v1-0001-Implement-jsonpath-.bigint-.integer-and-.number-m.patch
> >
> > This commit implements jsonpath .bigint(), .integer(), and .number()
> > methods.  The JSON string or a numeric value is converted to the
> > bigint, int4, and numeric type representation.
>
> A comment that applies to all of these: These add various keywords,
> switch cases, documentation entries in some order.  Are we happy with
> that?  Should we try to reorder all of that for better maintainability
> or readability?
>
> > v1-0002-Implement-.date-.time-.time_tz-.timestamp-and-.ti.patch
> >
> > This commit implements jsonpath .date(), .time(), .time_tz(),
> > .timestamp(), .timestamp_tz() methods.  The JSON string representing
> > a valid date/time is converted to the specific date or time type
> > representation.
> >
> > The changes use the infrastructure of the .datetime() method and
> > perform the datatype conversion as appropriate.  All these methods
> > accept no argument and use ISO datetime formats.
>
> These should accept an optional precision argument.  Did you plan to add
> that?

compiler warnings issue resolved.

I figured out how to use the precision argument.
But I don't know how to get the precision argument in the parse stage.

attached is my attempt to implement: select
jsonb_path_query('"2017-03-10 11:11:01.123"', '$.timestamp(2)');
not that familiar with src/backend/utils/adt/jsonpath_gram.y. imitate
decimal method failed. decimal has precision and scale two arguments.
here only one argument.

looking for hints.

Attachment

pgsql-hackers by date:

Previous
From: Thomas Munro
Date:
Subject: Re: LLVM 16 (opaque pointers)
Next
From: Thomas Munro
Date:
Subject: Re: LLVM 16 (opaque pointers)