Re: pgsql: Additional functions and operators for jsonb

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: "pgsql-committers(at)postgresql(dot)org" <pgsql-committers(at)postgresql(dot)org>
Subject: Re: pgsql: Additional functions and operators for jsonb
Date: 2015-05-12 20:11:25
Message-ID: CAFj8pRDX5KTc8C8yENzF1Z8APS=3sM3Z4T0gV1o+C8cbbxu3qw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Hi

I did some tests, and I am not sure if this is not bug:

postgres=# select '{"x":20}'::jsonb - 'x'::text;
ERROR: unknown type of jsonb container --->>> it should be empty jsonb,
not error
Time: 0.971 ms
postgres=# select '{"x":20, "y":30}'::jsonb - 'x'::text;
┌───────────┐
│ ?column? │
╞═══════════╡
│ {"y": 30} │
└───────────┘
(1 row)

Regards

Pavel

2015-05-12 21:55 GMT+02:00 Andrew Dunstan <andrew(at)dunslane(dot)net>:

> Additional functions and operators for jsonb
>
> jsonb_pretty(jsonb) produces nicely indented json output.
> jsonb || jsonb concatenates two jsonb values.
> jsonb - text removes a key and its associated value from the json
> jsonb - int removes the designated array element
> jsonb - text[] removes a key and associated value or array element at
> the designated path
> jsonb_replace(jsonb,text[],jsonb) replaces the array element designated
> by the path or the value associated with the key designated by the path
> with the given value.
>
> Original work by Dmitry Dolgov, adapted and reworked for PostgreSQL core
> by Andrew Dunstan, reviewed and tidied up by Petr Jelinek.
>
> Branch
> ------
> master
>
> Details
> -------
>
> http://git.postgresql.org/pg/commitdiff/c6947010ceb42143d9f047c65c1eac2b38928ab7
>
> Modified Files
> --------------
> doc/src/sgml/func.sgml | 62 +++
> src/backend/utils/adt/jsonb.c | 81 +++-
> src/backend/utils/adt/jsonfuncs.c | 717
> +++++++++++++++++++++++++++++++++
> src/include/catalog/pg_operator.h | 8 +
> src/include/catalog/pg_proc.h | 9 +-
> src/include/utils/jsonb.h | 19 +-
> src/test/regress/expected/jsonb.out | 424 ++++++++++++++++++-
> src/test/regress/expected/jsonb_1.out | 424 ++++++++++++++++++-
> src/test/regress/sql/jsonb.sql | 85 +++-
> 9 files changed, 1813 insertions(+), 16 deletions(-)
>
>
> --
> Sent via pgsql-committers mailing list (pgsql-committers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-committers
>

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2015-05-12 20:37:19 Re: pgsql: Additional functions and operators for jsonb
Previous Message Andrew Dunstan 2015-05-12 19:55:51 pgsql: Additional functions and operators for jsonb