update without SET ?

From: Michael Moore <michaeljmoore(at)gmail(dot)com>
To: postgres list <pgsql-sql(at)postgresql(dot)org>
Subject: update without SET ?
Date: 2016-02-03 18:49:22
Message-ID: CACpWLjNc9G3hZfkVViveirXRaLThzmah185xvsSPQxf8J+sX9A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

I want to UPDATE a table but I will not know until run time which columns
will be updated. I would like to do something like this:
update mytest t (SELECT * FROM
json_populate_record(null::mytest,'{"key":22,"header":44,"ident":66,"static01":"this","static02":"that"}'));

In other words, I will be receiving a json document on an input parameter.
The columns named in the json document can be a sub set of those that exist
in the table.

tia Mike

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Hector Vass 2016-02-03 20:59:37 Re: update without SET ?
Previous Message Jürgen Purtz 2016-02-03 18:46:27 Replication