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>
To: Ravi Krishna <srkrishna@vivaldi.net>
To: Laurenz Albe <laurenz.albe@cybertec.at>
To: pgsql-general@lists.postgresql.org
Subject: Re: existing row not found by SELECT ... WHERE CTID = ?
Date: Tue, 31 May 2022 20:03:25 +0200
Message-ID: <YpZYbcZCkKvbXRuU@c720-r368166> (raw)
In-Reply-To: <YpW3h6byY004R3el@c720-r368166>
References: <YozvP4+Nl9gR+Jg1@c720-r368166>
	<f13384d06765428071c47c143e0d5428f2d59d30.camel@cybertec.at>
	<1652228.1653408709@sss.pgh.pa.us>
	<Yo31JTTUm1S/R2k/@pureos>
	<de368023ce9d002ab169428175d27108f6c17cb6.camel@cybertec.at>
	<cfd26d7f4d955e450c351b9bc7ddeb07@vivaldi.net>
	<1924203.1653489504@sss.pgh.pa.us>
	<YpW3h6byY004R3el@c720-r368166>


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





view thread (18+ messages)

Message-ID: <YpZYbcZCkKvbXRuU@c720-r368166>
Permalink:  ../YpZYbcZCkKvbXRuU@c720-r368166/
Also on:    postgresql.org/message-id/YpZYbcZCkKvbXRuU@c720-r368166

 · 

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, srkrishna@vivaldi.net, laurenz.albe@cybertec.at
  Subject: Re: existing row not found by SELECT ... WHERE CTID = ?
  In-Reply-To: <YpZYbcZCkKvbXRuU@c720-r368166>
  References: <YozvP4+Nl9gR+Jg1@c720-r368166> <f13384d06765428071c47c143e0d5428f2d59d30.camel@cybertec.at> <1652228.1653408709@sss.pgh.pa.us> <Yo31JTTUm1S/R2k/@pureos> <de368023ce9d002ab169428175d27108f6c17cb6.camel@cybertec.at> <cfd26d7f4d955e450c351b9bc7ddeb07@vivaldi.net> <1924203.1653489504@sss.pgh.pa.us> <YpW3h6byY004R3el@c720-r368166> <YpZYbcZCkKvbXRuU@c720-r368166>

* 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