Update and Delete operations for jsonb (part 1 of 2)
Channel: Andrea Ross
Date: 02/07/2015

by Andrew Dunstan

providing some needed functions and operators for jsonb


Postgres 9.4 introduced the new jsonb type, However, it is missing some functions, particularly for json composition, that are needed by many users.

In this talk we present an extension that provides some of these functions, and work to incorporate the functions in 9.5.

Operations include replacement and deletion of array elements and object fields, and composition by concatentation of objects and arrays.

Arrays can also be concatenated with scalar values, and array elements can be replaced or deleted by counting from either end of the array. Thus we have the ability to use json arrays as queues and stacks, with basic push/pop and shift/unshift capability.

A pretty print function for jsonb is also provided.

We will also outline what work we think remains, and discuss possible ideas on how to make json composition more naturally expressed.