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 1j3ieY-0006XL-ML for pgsql-general@arkaria.postgresql.org; Mon, 17 Feb 2020 15:49:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1j3ieX-000833-1j for pgsql-general@arkaria.postgresql.org; Mon, 17 Feb 2020 15:49:45 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1j3ieW-00081T-Kz for pgsql-general@lists.postgresql.org; Mon, 17 Feb 2020 15:49:44 +0000 Received: from ms-10.1blu.de ([178.254.4.101]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1j3ieP-00079K-JU for pgsql-general@lists.postgresql.org; Mon, 17 Feb 2020 15:49:43 +0000 Received: from [188.174.52.220] (helo=localhost.unixarea.de) by ms-10.1blu.de with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.86_2) (envelope-from ) id 1j3ieK-0006Tt-3Z; Mon, 17 Feb 2020 16:49:32 +0100 Received: from localhost.my.domain (localhost [127.0.0.1]) by localhost.unixarea.de (8.15.2/8.14.9) with ESMTPS id 01HFnTmo002777 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 17 Feb 2020 16:49:30 +0100 (CET) (envelope-from guru@unixarea.de) Received: (from guru@localhost) by localhost.my.domain (8.15.2/8.14.9/Submit) id 01HFnRTV002776; Mon, 17 Feb 2020 16:49:27 +0100 (CET) (envelope-from guru@unixarea.de) X-Authentication-Warning: localhost.my.domain: guru set sender to guru@unixarea.de using -f Date: Mon, 17 Feb 2020 16:49:27 +0100 From: Matthias Apitz To: pgsql-general@lists.postgresql.org Subject: DBI && INSERT Message-ID: <20200217154927.GA2720@c720-r342378> Reply-To: Matthias Apitz MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit X-Operating-System: FreeBSD 13.0-CURRENT r342378 (amd64) X-message-flag: Mails containing HTML will not be read! Please send only plain text. User-Agent: Mutt/1.11.1 (2018-12-01) X-Con-Id: 51246 X-Con-U: 0-guru X-Originating-IP: 188.174.52.220 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hello, 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). If one fired up the same string in $my_sqlstatement with pgsql the result was always INSERT 0 1 At the end of the day I watched with strace the communication on the network between the DBI client and the PG server: ... 13576 sendto(3, "6f7374656e20676573636872696562656e3a303a0a726561645f656469666163745f66696c65733a3a6d61696e20456e646520616d2031372e30322e3230323020756d2031363a30303a3234205568720a6c6f67206265656e6465742c206a65747a74207769726420696e7365727420646573206c6f677320696e206163715f7661726461746120766572737563687420286e757220696d207472616365207369636874626172290a', \n 1)\0", 359, MSG_NOSIGNAL, NULL, 0) = 359 13576 poll([{fd=3, events=POLLIN|POLLERR}], 1, 4294967295) = 1 ([{fd=3, revents=POLLIN}]) 13576 recvfrom(3, "C\0\0\0\17INSERT 0 1\0Z\0\0\0\5I", 32768, 0, NULL, NULL) = 22 13576 write(4, " <- do= ( 1 ) [1 items] at read_edifact_files.pl line 8831\n", 62) = 62 13576 write(4, " -> $DBI::errstr (&) FETCH from lasth=HASH\n", 46) = 46 13576 write(4, " <- $DBI::errstr= undef\n", 27) = 27 ... i.e. the response on the network was (always) also 'INSERT 0 1' and DBI misinterprets this as an error condition with 'undef' $DBI::errstr string. matthias -- Matthias Apitz, ✉ guru@unixarea.de, http://www.unixarea.de/ +49-176-38902045 Public GnuPG key: http://www.unixarea.de/key.pub