pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Matthias Apitz <guru@unixarea.de>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: existing row not found by SELECT ... WHERE CTID = ?
Date: Tue, 24 May 2022 17:42:26 +0200
Message-ID: <Yoz84iffDHkIIarP@pureos> (raw)
In-Reply-To: <1544722.1653403631@sss.pgh.pa.us>
References: <YozvP4+Nl9gR+Jg1@c720-r368166>
	<1544722.1653403631@sss.pgh.pa.us>

El día martes, mayo 24, 2022 a las 10:47:11 -0400, Tom Lane escribió:

> Matthias Apitz <guru@unixarea.de> 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





view thread (18+ messages)  latest in thread

Message-ID: <Yoz84iffDHkIIarP@pureos>
Permalink:  ../Yoz84iffDHkIIarP@pureos/
Also on:    postgresql.org/message-id/Yoz84iffDHkIIarP@pureos

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: guru@unixarea.de, tgl@sss.pgh.pa.us
  Subject: Re: existing row not found by SELECT ... WHERE CTID = ?
  In-Reply-To: <Yoz84iffDHkIIarP@pureos>
  References: <YozvP4+Nl9gR+Jg1@c720-r368166> <1544722.1653403631@sss.pgh.pa.us> <Yoz84iffDHkIIarP@pureos>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox