Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1j3j43-0007Oi-Pu for pgsql-general@arkaria.postgresql.org; Mon, 17 Feb 2020 16:16:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1j3j42-0007Ne-Bq for pgsql-general@arkaria.postgresql.org; Mon, 17 Feb 2020 16:16:06 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1j3j42-0007NW-29 for pgsql-general@lists.postgresql.org; Mon, 17 Feb 2020 16:16:06 +0000 Received: from mail.thenautilus.net ([5.79.87.27]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1j3j3z-0000Zd-Mw for pgsql-general@lists.postgresql.org; Mon, 17 Feb 2020 16:16:05 +0000 Received: (qmail 13923 invoked from network); 17 Feb 2020 16:15:41 -0000 Received: from unknown (HELO exelion) (dakkar@::ffff:10.111.0.30) by 0 with ESMTPA; 17 Feb 2020 16:15:41 -0000 Date: Mon, 17 Feb 2020 16:15:40 +0000 From: Gianni Ceccarelli To: pgsql-general@lists.postgresql.org Cc: Matthias Apitz Subject: Re: DBI && INSERT Message-ID: <20200217161540.1a8d02e5@exelion> In-Reply-To: <20200217154927.GA2720@c720-r342378> References: <20200217154927.GA2720@c720-r342378> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Mon, 17 Feb 2020 16:49:27 +0100 Matthias Apitz wrote: > I spend today some hours to nail down and insert problem into our > database with DBI like: > > my $rc = $my_dbh->do($my_sqlstatement); > > which returns 1 in $rc (which the following flow in our script took > as an error). The DBI docs say:: $rows = $dbh->do($statement) or die $dbh->errstr; so when ``do`` returns 1, it means it worked, not that it failed. In particular: Returns the number of rows affected or "undef" on error. A return value of "-1" means the number of rows is not known, not applicable, or not available. -- Dakkar - GPG public key fingerprint = A071 E618 DD2C 5901 9574 6FE2 40EA 9883 7519 3F88 key id = 0x75193F88