pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: David Christensen <david@endpoint.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #16676: SELECT ... FETCH FIRST ROW WITH TIES FOR UPDATE SKIP LOCKED locks rows it doesn't return
Date: Tue, 20 Oct 2020 09:23:06 -0500
Message-ID: <05226762-2C0B-44DE-A584-D9FCCFF06B5F@endpoint.com> (raw)
In-Reply-To: <604509.1603203416@sss.pgh.pa.us>
References: <20201020134114.GA11045@alvherre.pgsql>
	<604509.1603203416@sss.pgh.pa.us>

> On Oct 20, 2020, at 9:16 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> 
> Alvaro Herrera <alvherre@alvh.no-ip.org> writes:
>> On 2020-Oct-19, David Christensen wrote:
>>> Maybe splitting LockRows into two nodes, one for locking and one for
>>> emitting unlocked nodes then interleaving Limit in between? (Or only
>>> doing something along these lines for this admittedly narrow use case.)
> 
>> I was having a similar idea, but the main reason I don't think it's a
>> good fix is that we can't backpatch such a change to pg13.
> 
> Um, why not?  I don't have a position yet on whether this is a good way
> to fix it; but if we did do it, AFAICS the only thing we'd have to be
> careful of in v13 is not renumbering existing NodeTag values.
> 
> If your concern is just that EXPLAIN plans will look different, the same
> could be said of David's other proposal.

If we can determine the scope to which these different nodes might be used and make it so it still uses the existing node structure for most existing cases (i.e., maybe an additional parameter to create_lockrows_plan or similar) then that might work; AFAIK, this is the first time we’ve had to consider this sort of thing (though I do wonder if there might be something in window functions which might bump into this sort of issue).

I’m working on an isolation test to formalize this failure, which I can do as a separate patch if we want to have this prior to implementing a fix.

--
David Christensen
Senior Software and Database Engineer
End Point Corporation
david@endpoint.com
785-727-1171

Attachments:

  signature.asc (application/pgp-signature, 832B) download

view thread (10+ messages)  latest in thread

Message-ID: <05226762-2C0B-44DE-A584-D9FCCFF06B5F@endpoint.com>
Permalink:  ../05226762-2C0B-44DE-A584-D9FCCFF06B5F@endpoint.com/
Also on:    postgresql.org/message-id/05226762-2C0B-44DE-A584-D9FCCFF06B5F@endpoint.com

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: david@endpoint.com, tgl@sss.pgh.pa.us, alvherre@alvh.no-ip.org, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #16676: SELECT ... FETCH FIRST ROW WITH TIES FOR UPDATE SKIP LOCKED locks rows it doesn't return
  In-Reply-To: <05226762-2C0B-44DE-A584-D9FCCFF06B5F@endpoint.com>

* 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