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]
- Prev by Date: Re: Storing Video's or vedio file in DB.
- Next by Date: Re: Storing Video's or vedio file in DB.
- Previous by thread: Storing Video's or vedio file in DB.
- Next by thread: Strange error message when reference non-existent column foo."count"
- Index(es):