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

From Tom Lane
Subject Re: How to call JSONB_INSERT with integer as the new to-be-inserted value?
Date
Msg-id 663494.1599945984@sss.pgh.pa.us
Whole thread Raw
In response to How to call JSONB_INSERT with integer as the new to-be-inserted value?  (Alexander Farber <alexander.farber@gmail.com>)
Responses Re: How to call JSONB_INSERT with integer as the new to-be-inserted value?  (Alexander Farber <alexander.farber@gmail.com>)
List pgsql-general
Alexander Farber <alexander.farber@gmail.com> 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 JSONB_INSERT(_user, '{uid}', _uid)
> CONTEXT:  PL/pgSQL function words_get_user(jsonb) line 44 at assignment

I think it'd work to do

JSONB_INSERT(_user, '{uid}', to_jsonb(_uid));

The third argument has to be jsonb, not something else.

            regards, tom lane



pgsql-general by date:

Previous
From: Steve Baldwin
Date:
Subject: Re: How to call JSONB_INSERT with integer as the new to-be-inserted value?
Next
From: Alexander Farber
Date:
Subject: Re: How to call JSONB_INSERT with integer as the new to-be-inserted value?