Search Postgresql Archives

Manipulating jsonb

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I'm playing with a 9.4 preview and the upcoming jsonb datatype. But
I'm missing the basic modification syntax.

Given the following situation:

    CREATE TABLE test(key int, jsonval jsonb);
    INSERT INTO test VALUES(1, '{"a": 1, "c": 3}');

How can I UPDATE that row with '{"b": 2, "d": 4}' ? Something like
this does not work:

    UPDATE test SET jsonval = jsonval || '{"a": 1, "c": 3}'::jsonb
where key = 1;

The result should be

    {"a": 1, "b": 2, "c": 3, "d": 4}

The same goes for removing values.

Did I overlook something obvious or is there really no way to do that right now?

Best regards,
Andreas Heiduk


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux