Search Postgresql Archives

Feature Request: json_extend, jsonb_extend

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

 



It would be nice if PostgreSQL has *_extend (similar to $.extend from jQuery or _.extend from UnderscoreJs) for JSON/JSONB columns, so we could write it like this:

UPDATE tablename 
  SET jsoncolumn = json_extend(jsoncolumn, $2) 
  WHERE id = $1;

instead of this:

UPDATE tablename 
  SET data = "">
    SELECT json_object_agg(key, value)::jsonb 
      FROM 
        ( SELECT * FROM jsonb_each( SELECT data FROM tablename WHERE id=$1 )
          UNION ALL
          SELECT * FROM jsonb_each( $2 ) 
        ) x1
  ) WHERE id=$1;

[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