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

From Jeevan Chalke
Subject More new SQL/JSON item methods
Date
Msg-id CAM2+6=XjTyqrrqHAOj80r0wVQxJSxc0iyib9bPC55uFO9VKatg@mail.gmail.com
Whole thread Raw
Responses Re: More new SQL/JSON item methods
Re: More new SQL/JSON item methods
List pgsql-hackers
Hi,

Attached various patches to implement a few more jsonpath item methods.

For context, PostgreSQL already has some item methods, such as .double() and 
.datetime().  The above new methods are just added alongside these.

Here are the brief descriptions for the same.

---

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.

---

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.

---

v1-0003-Implement-jsonpath-.boolean-and-.string-methods.patch

This commit implements jsonpath .boolean() and .string() methods.

.boolean() method converts the given JSON string, numeric, or boolean
value to the boolean type representation.  In the numeric case, only
integers are allowed, whereas we use the parse_bool() backend function
to convert a string to a bool.

.string() method uses the datatype's out function to convert numeric
and various date/time types to the string representation.

---

v1-0004-Implement-jasonpath-.decimal-precision-scale-meth.patch

This commit implements jsonpath .decimal() method with optional
precision and scale.  If precision and scale are provided, then
it is converted to the equivalent numerictypmod and applied to the
numeric number.

---

Suggestions/feedback/comments, please...

Thanks

--
Jeevan Chalke
Senior Staff SDE, Database Architect, and Manager
Product Development




edbpostgres.com
Attachment

pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: Use FD_CLOEXEC on ListenSockets (was Re: Refactoring backend fork+exec code)
Next
From: Peter Smith
Date:
Subject: Re: logical_replication_mode