Re: existing row not found by SELECT ... WHERE CTID = ? - Mailing list pgsql-general

From Matthias Apitz
Subject Re: existing row not found by SELECT ... WHERE CTID = ?
Date
Msg-id Yoz84iffDHkIIarP@pureos
Whole thread Raw
In response to Re: existing row not found by SELECT ... WHERE CTID = ?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
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



pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: Can I start Update row in After Insert trigger function?
Next
From: Laurenz Albe
Date:
Subject: Re: existing row not found by SELECT ... WHERE CTID = ?