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 <[email protected]>:
> 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 ([email protected])
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-committers
>