pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Ravi Krishna <srkrishna@vivaldi.net>
Cc: Laurenz Albe <laurenz.albe@cybertec.at>
Cc: Matthias Apitz <guru@unixarea.de>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: existing row not found by SELECT ... WHERE CTID = ?
Date: Wed, 25 May 2022 10:38:24 -0400
Message-ID: <1924203.1653489504@sss.pgh.pa.us> (raw)
In-Reply-To: <cfd26d7f4d955e450c351b9bc7ddeb07@vivaldi.net>
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>

Ravi Krishna <srkrishna@vivaldi.net> writes:
>> No.  PostgreSQL may remove a dead row, but a dead row is by definition
>> no longer visible, so it wouldn't be found by a query.

> I am wondering whether it is a good practice to use CTID in a where 
> clause.

It's fine if part of your business logic is that you don't want to allow
concurrent updates.  In this case, the OP seems to want to prevent rather
than tolerate the concurrent update, so I don't think he needs to revisit
the app's use of CTID.

If you do need to support concurrent updates, then yeah relying on CTID
is likely to be problematic.

			regards, tom lane





view thread (18+ messages)  latest in thread

Message-ID: <1924203.1653489504@sss.pgh.pa.us>
Permalink:  ../1924203.1653489504@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1924203.1653489504@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, srkrishna@vivaldi.net, laurenz.albe@cybertec.at, guru@unixarea.de
  Subject: Re: existing row not found by SELECT ... WHERE CTID = ?
  In-Reply-To: <1924203.1653489504@sss.pgh.pa.us>
  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>

* 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