Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kHD2Z-0003g4-Kv for pgsql-general@arkaria.postgresql.org; Sat, 12 Sep 2020 21:26:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kHD2X-0005PU-Ns for pgsql-general@arkaria.postgresql.org; Sat, 12 Sep 2020 21:26:33 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kHD2X-0005PN-G4 for pgsql-general@lists.postgresql.org; Sat, 12 Sep 2020 21:26:33 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kHD2R-0002nd-4l for pgsql-general@postgresql.org; Sat, 12 Sep 2020 21:26:32 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 08CLQOUV663495; Sat, 12 Sep 2020 17:26:24 -0400 From: Tom Lane To: Alexander Farber cc: pgsql-general Subject: Re: How to call JSONB_INSERT with integer as the new to-be-inserted value? In-reply-to: References: Comments: In-reply-to Alexander Farber message dated "Sat, 12 Sep 2020 22:54:40 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <663493.1599945984.1@sss.pgh.pa.us> Date: Sat, 12 Sep 2020 17:26:24 -0400 Message-ID: <663494.1599945984@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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 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