Re: More new SQL/JSON item methods
От | Jeevan Chalke |
---|---|
Тема | Re: More new SQL/JSON item methods |
Дата | |
Msg-id | CAM2+6=WNGQ6GYcR7bkm=O46bwYG39ZKkGTJ9j2tdO25tZHbtvA@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: More new SQL/JSON item methods (jian he <jian.universality@gmail.com>) |
Список | pgsql-hackers |
On Wed, Oct 18, 2023 at 4:50 PM jian he <jian.universality@gmail.com> wrote:
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.
Thanks for pitching in, Jian.
I was slightly busy with other stuff and thus could not spend time on this.
I will start looking into it and expect a patch in a couple of days.
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.
You may refer to how .datetime(<format>) is implemented.
Thanks
В списке pgsql-hackers по дате отправления: