pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Geoghegan <pg@bowt.ie>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Remove unneeded nbtree array preprocessing assert.
Date: Mon, 22 Apr 2024 17:58:30 +0000
Message-ID: <E1ryxvx-003MQc-KK@gemulon.postgresql.org> (raw)

Remove unneeded nbtree array preprocessing assert.

Certain cases involving the use of cursors had assertion failures within
_bt_preprocess_keys's recently added no-op return path.  The assertion
in question made the faulty assumption that a second or third call to
_bt_preprocess_keys (within the same btrescan) could only happen when
another scheduled primitive index scan was just about to begin.

It would be possible to address the problem by only allowing scans that
have array keys to take the new no-op path, forcing affected cases to
perform redundant preprocessing work.  It seems simpler to just remove
the assertion, and reframe the no-op path as a more general mechanism.
Take this simpler approach.

The important underlying principle is that we only need to perform
preprocessing once per btrescan (at most).  This is expected regardless
of whether or not the scan happens to have array keys.

Oversight in commit 1b134ca5, which enhanced nbtree ScalarArrayOp
execution.

Reported-By: Alexander Lakhin <exclusion@gmail.com>
Discussion: https://postgr.es/m/ef0f7c8b-a6fa-362e-6fd6-054950f947ca@gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/480bc6e3ed3a5719cdec076d4943b119890e8171

Modified Files
--------------
src/backend/access/nbtree/nbtutils.c | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)



view thread (2+ messages)

Message-ID: <E1ryxvx-003MQc-KK@gemulon.postgresql.org>
Permalink:  ../E1ryxvx-003MQc-KK@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1ryxvx-003MQc-KK@gemulon.postgresql.org

 · 

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-committers@postgresql.org
  Cc: pg@bowt.ie, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Remove unneeded nbtree array preprocessing assert.
  In-Reply-To: <E1ryxvx-003MQc-KK@gemulon.postgresql.org>

* 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