Re: [GENERAL] plpgsql update row from record variable

2016-04-03 Thread Adrian Klaver
On 04/02/2016 06:07 PM, Seamus Abshere wrote: hi, I want to write a function that updates arbitrary columns and here's my pseudocode: CREATE OR REPLACE FUNCTION update_pet(id int, raw_data jsonb) RETURNS VOID AS $$ DECLARE data record; BEGIN SELECT jsonb_populate_record(null::pets,

[GENERAL] plpgsql update row from record variable

2016-04-02 Thread Seamus Abshere
hi, I want to write a function that updates arbitrary columns and here's my pseudocode: CREATE OR REPLACE FUNCTION update_pet(id int, raw_data jsonb) RETURNS VOID AS $$ DECLARE data record; BEGIN SELECT jsonb_populate_record(null::pets, raw_data) INTO data; UPDATE pets [... from data ...]