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 1ntWgD-0007SO-IU for pgsql-general@arkaria.postgresql.org; Tue, 24 May 2022 15:42:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ntWgA-00074v-MQ for pgsql-general@arkaria.postgresql.org; Tue, 24 May 2022 15:42:38 +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 1ntWgA-0006yt-9e for pgsql-general@lists.postgresql.org; Tue, 24 May 2022 15:42:38 +0000 Received: from ms-10.1blu.de ([178.254.4.101]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ntWg3-00062I-Dc for pgsql-general@lists.postgresql.org; Tue, 24 May 2022 15:42:37 +0000 Received: from [188.174.54.12] (helo=pureos) by ms-10.1blu.de with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ntWg1-0004Wl-1j; Tue, 24 May 2022 17:42:29 +0200 Date: Tue, 24 May 2022 17:42:26 +0200 From: Matthias Apitz To: Tom Lane Cc: pgsql-general@lists.postgresql.org Subject: Re: existing row not found by SELECT ... WHERE CTID = ? Message-ID: Reply-To: Matthias Apitz References: <1544722.1653403631@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: <1544722.1653403631@sss.pgh.pa.us> 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: 188.174.54.12 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk El día martes, mayo 24, 2022 a las 10:47:11 -0400, Tom Lane escribió: > Matthias Apitz writes: > > We have a C-written program, written in ESQL/C, of our LMS where the logic > > crawls with FETCH through a hit list and does UPDATE on some rows which > > match certain condition. This works fine for thousands of rows every night, > > but magically sometimes it fails. > > Maybe something else already updated the row since the cursor was opened? > That would change its CTID. If you compare the time when the CTID was read: [29858] [23.05.2022 23:21:21:842]: ecpg_get_data on line 2655: RESULT: (668486,20) offset: 19; array: no with the time when it was not found: [29858] [23.05.2022 23:21:21:844]: raising sqlcode 100 on line 2531: no data found on line 2531 it's nearly imposible that our software could have done this. Maybe VACUUM hits exactly this moment in time and row, but this sounds also like 5 good numbers in the lotery jackpot :-) Thanks matthias -- Matthias Apitz, ✉ guru@unixarea.de, http://www.unixarea.de/ +49-176-38902045 Public GnuPG key: http://www.unixarea.de/key.pub