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 1nw6DO-0002xx-N2 for pgsql-general@arkaria.postgresql.org; Tue, 31 May 2022 18:03:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nw6DN-00083c-Gv for pgsql-general@arkaria.postgresql.org; Tue, 31 May 2022 18:03:33 +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 1nw6DN-00083T-6S for pgsql-general@lists.postgresql.org; Tue, 31 May 2022 18:03:33 +0000 Received: from ms-10.1blu.de ([178.254.4.101]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nw6DK-0002t4-Nw for pgsql-general@lists.postgresql.org; Tue, 31 May 2022 18:03:32 +0000 Received: from [95.114.56.68] (helo=localhost.unixarea.de) by ms-10.1blu.de with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nw6DH-0001Jr-D7; Tue, 31 May 2022 20:03:27 +0200 Received: from localhost.my.domain (localhost [127.0.0.1]) by localhost.unixarea.de (8.16.1/8.14.9) with ESMTPS id 24VI3QMA016518 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Tue, 31 May 2022 20:03:26 +0200 (CEST) (envelope-from guru@unixarea.de) Received: (from guru@localhost) by localhost.my.domain (8.16.1/8.14.9/Submit) id 24VI3PI7016517; Tue, 31 May 2022 20:03:25 +0200 (CEST) (envelope-from guru@unixarea.de) X-Authentication-Warning: localhost.my.domain: guru set sender to guru@unixarea.de using -f Date: Tue, 31 May 2022 20:03:25 +0200 From: Matthias Apitz To: Tom Lane , Ravi Krishna , Laurenz Albe , pgsql-general@lists.postgresql.org Subject: Re: existing row not found by SELECT ... WHERE CTID = ? Message-ID: Reply-To: Matthias Apitz References: <1652228.1653408709@sss.pgh.pa.us> <1924203.1653489504@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Operating-System: FreeBSD 13.0-CURRENT r368166 (amd64) X-message-flag: Mails containing HTML will not be read! Please send only plain text. X-Con-Id: 51246 X-Con-U: 0-guru X-Originating-IP: 95.114.56.68 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Analizing our logs in more detail, we got to know that there are cases where, after updating a row with something like: EXEC SQL UPDATE d01buch SET d01gsi =:d01gsi, d01ex =:d01ex, ... d01vldate =:d01vldate WHERE CURRENT OF hc_d01buch; we look-up the same row later again with its old CTID in :rowid; one solution of it could be right after the UPDATE look-up the new CTID with: EXEC SQL SELECT ctid INTO :rowid FROM d01buch WHERE CURRENT OF hc_d01buch; i.e. using the same CURSOR which was used for the UPDATE again for a SELECT for the CTID. Can this work? matthias -- Matthias Apitz, ✉ guru@unixarea.de, http://www.unixarea.de/ +49-176-38902045 Public GnuPG key: http://www.unixarea.de/key.pub