pgsql: Relax assertion in finding correct GiST parent

From: Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Relax assertion in finding correct GiST parent
Date: 2025-04-04 11:04:49
Message-ID: E1u0eqv-002cd1-1R@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Relax assertion in finding correct GiST parent

Commit 28d3c2ddcf introduced an assertion that if the memorized
downlink location in the insertion stack isn't valid, the parent's
LSN should've changed too. Turns out that was too strict. In
gistFindCorrectParent(), if we walk right, we update the parent's
block number and clear its memorized 'downlinkoffnum'. That triggered
the assertion on next call to gistFindCorrectParent(), if the parent
needed to be split too. Relax the assertion, so that it's OK if
downlinkOffnum is InvalidOffsetNumber.

Backpatch to v13-, all supported versions. The assertion was added in
commit 28d3c2ddcf in v12.

Reported-by: Alexander Lakhin <exclusion(at)gmail(dot)com>
Reviewed-by: Tender Wang <tndrwang(at)gmail(dot)com>
Discussion: https://www.postgresql.org/message-id/18396-03cac9beb2f7aac3@postgresql.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/7afca7edef751b8d7c0f5b6402ffcefc11c67fdd

Modified Files
--------------
src/backend/access/gist/gist.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Heikki Linnakangas 2025-04-04 12:18:21 pgsql: docs: Clarify that NULL arg to set_config() means reset to defau
Previous Message Fujii Masao 2025-04-04 10:33:00 pgsql: Allow "COPY table TO" command to copy rows from materialized vie