From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alexander Farber <alexander.farber@gmail.com>
Cc: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: How to call JSONB_INSERT with integer as the new to-be-inserted value?
Date: Sat, 12 Sep 2020 17:26:24 -0400
Message-ID: <663494.1599945984@sss.pgh.pa.us> (raw)
In-Reply-To: <CAADeyWgGW7dhUV4nL17iTR3a4=uNW7hdHbGwK=gy4pD61Ar25Q@mail.gmail.com>
References: <CAADeyWgGW7dhUV4nL17iTR3a4=uNW7hdHbGwK=gy4pD61Ar25Q@mail.gmail.com>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, alexander.farber@gmail.com
Subject: Re: How to call JSONB_INSERT with integer as the new to-be-inserted value?
In-Reply-To: <663494.1599945984@sss.pgh.pa.us>
References: <CAADeyWgGW7dhUV4nL17iTR3a4=uNW7hdHbGwK=gy4pD61Ar25Q@mail.gmail.com> <663494.1599945984@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox