Re: How to call JSONB_INSERT with integer as the new to-be-inserted value?

2020-09-12 Thread Tom Lane
Alexander Farber writes: > ERROR: function jsonb_insert(jsonb, unknown, integer) does not exist > LINE 1: SELECT JSONB_INSERT(_user, '{uid}', _uid) >^ > HINT: No function matches the given name and argument types. You might > need to add explicit type casts. > QUERY: SELECT

Re: How to call JSONB_INSERT with integer as the new to-be-inserted value?

2020-09-12 Thread Steve Baldwin
Hi Alex, Try something like this: b2bc_dev=# select jsonb_insert('{"hello": "world"}'::jsonb, '{uid}'::text[], to_jsonb(1)); jsonb_insert -- {"uid": 1, "hello": "world"} (1 row) Steve On Sun, Sep 13, 2020 at 6:55 AM Alexander Farber wrote: > Good

How to call JSONB_INSERT with integer as the new to-be-inserted value?

2020-09-12 Thread Alexander Farber
Good evening, I am trying to take a JSONB object (comes from an HTTP cookie set by my app) and add a property "uid" to it, which should hold an integer: CREATE OR REPLACE FUNCTION words_get_user( in_users jsonb, OUT out_user jsonb ) RETURNS jsonb AS $func$