pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Laurenz Albe <laurenz.albe@cybertec.at>
To: Christoph Moench-Tegeder <cmt@burggraben.net>
To: Matthias Apitz <guru@unixarea.de>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: existing row not found by SELECT ... WHERE CTID = ?
Date: Wed, 25 May 2022 15:22:39 +0200
Message-ID: <a4128a144406c3cd730fbc442d71ba5afe31af4f.camel@cybertec.at> (raw)
In-Reply-To: <Yo4gxgkAIdqVkMS6@elch.exwg.net>
References: <YozvP4+Nl9gR+Jg1@c720-r368166>
	<f13384d06765428071c47c143e0d5428f2d59d30.camel@cybertec.at>
	<1652228.1653408709@sss.pgh.pa.us>
	<Yo31JTTUm1S/R2k/@pureos>
	<de368023ce9d002ab169428175d27108f6c17cb6.camel@cybertec.at>
	<20220525120112.GA17@sh4-5.1blu.de>
	<Yo4gxgkAIdqVkMS6@elch.exwg.net>

On Wed, 2022-05-25 at 14:27 +0200, Christoph Moench-Tegeder wrote:
> ## Matthias Apitz (guru@unixarea.de):
> 
> > We will solve the problem now with setting the session after connect to
> > 
> >    SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL REPEATABLE READ;
> > 
> > (with an appropriate ESQL/C call). Any comments?
> 
> Maybe the real question is whether it is wise to use an implementation
> artifact (ctid) to identify rows?
> The textbook approach could be row locks (SELECT ... FOR SHARE/UPDATE and
> variants) to prevent concurrent changes or optimistic locking  (and a
> primary key in any case) - but maybe you already investigated those options?

Right.

REPEATABLE READ won't help you there.  True, you will see a stable snapshot
of the database inside a single transaction, but if a concurrent session has
modified the row, you will get a serialization error.
So that is not a solution.

Yours,
Laurenz Albe





view thread (18+ messages)  latest in thread

Message-ID: <a4128a144406c3cd730fbc442d71ba5afe31af4f.camel@cybertec.at>
Permalink:  ../a4128a144406c3cd730fbc442d71ba5afe31af4f.camel@cybertec.at/
Also on:    postgresql.org/message-id/a4128a144406c3cd730fbc442d71ba5afe31af4f.camel@cybertec.at

 · 

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: laurenz.albe@cybertec.at, cmt@burggraben.net, guru@unixarea.de, tgl@sss.pgh.pa.us
  Subject: Re: existing row not found by SELECT ... WHERE CTID = ?
  In-Reply-To: <a4128a144406c3cd730fbc442d71ba5afe31af4f.camel@cybertec.at>
  References: <YozvP4+Nl9gR+Jg1@c720-r368166> <f13384d06765428071c47c143e0d5428f2d59d30.camel@cybertec.at> <1652228.1653408709@sss.pgh.pa.us> <Yo31JTTUm1S/R2k/@pureos> <de368023ce9d002ab169428175d27108f6c17cb6.camel@cybertec.at> <20220525120112.GA17@sh4-5.1blu.de> <Yo4gxgkAIdqVkMS6@elch.exwg.net> <a4128a144406c3cd730fbc442d71ba5afe31af4f.camel@cybertec.at>

* 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