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 1og8xJ-0001Ia-2v for pgsql-general@arkaria.postgresql.org; Wed, 05 Oct 2022 18:17:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1og8xH-0002e4-Tu for pgsql-general@arkaria.postgresql.org; Wed, 05 Oct 2022 18:17:15 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1og8xH-0002dv-JM for pgsql-general@lists.postgresql.org; Wed, 05 Oct 2022 18:17:15 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1og8xE-0000wS-Uu for pgsql-general@lists.postgresql.org; Wed, 05 Oct 2022 18:17:15 +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 295IH8Zu2433847; Wed, 5 Oct 2022 14:17:08 -0400 From: Tom Lane To: Laurenz Albe cc: Dominique Devienne , pgsql-general@lists.postgresql.org Subject: Re: Number of updated rows with LibPQ In-reply-to: <830241525f7fefeab2000203b6fcf0a6b815ee6e.camel@cybertec.at> References: <830241525f7fefeab2000203b6fcf0a6b815ee6e.camel@cybertec.at> Comments: In-reply-to Laurenz Albe message dated "Wed, 05 Oct 2022 18:09:15 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2433845.1664993828.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Wed, 05 Oct 2022 14:17:08 -0400 Message-ID: <2433846.1664993828@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Laurenz Albe writes: > On Wed, 2022-10-05 at 16:38 +0200, Dominique Devienne wrote: >> For selects, I have [PQnTuples][2], but what to do on INSERT, UPDATE, D= ELETE? >> Parse the result of PQcmdTuples myself??? If so, what's the 0 in the >> INSERT below? > Yes, you have to use PQcmdTuples(), and you have to convert the string t= o an integer. > But don't worry: the result will *not* be "INSERT 0 5", it will be just = "5", so > you won't have to parse anything. Yeah, just applying atoi() or atol() to the result should be enough. regards, tom lane