From: | Peter Geoghegan <pg(at)bowt(dot)ie> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Make NULL tuple values always advance skip arrays. |
Date: | 2025-04-28 16:11:45 |
Message-ID: | E1u9R57-000250-27@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Make NULL tuple values always advance skip arrays.
_bt_check_compare neglected to handle a case that can arise when the
scan's keys are temporarily treated as nonrequired, as an optimization:
whenever a NULL tuple value was encountered that had a skip array whose
current element wasn't already NULL, _bt_check_compare failed to advance
the array to the NULL element. This allowed _bt_check_compare to fail
to return matching tuples containing a NULL value (though only with an
array column that came before a skip array column with NULLs, and only
during _bt_readpage calls that set pstate.forcenonrequired=true on a
page where the higher-order column also had to advance).
To fix, teach _bt_check_compare to handle this case just like any other
case where a skip array key is unsatisfied and must be advanced directly
(due to the key being considered a nonrequired key).
Oversight in commit 8a510275, which optimized nbtree search scan key
comparisons with skip arrays.
Author: Peter Geoghegan <pg(at)bowt(dot)ie>
Reported-By: Mark Dilger <mark(dot)dilger(at)enterprisedb(dot)com>
Discussion: https://postgr.es/m/CAHgHdKtLFWZcjr87hMH0hYDHgcifu4Tj7iHz-xh8qsJREt5cqA@mail.gmail.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/b75fedcab7916e1c955dbab565b7ad0cee6b37c6
Modified Files
--------------
src/backend/access/nbtree/nbtutils.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Geoghegan | 2025-04-28 16:12:05 | Re: pgsql: Improve nbtree skip scan primitive scan scheduling. |
Previous Message | Álvaro Herrera | 2025-04-28 14:42:35 | pgsql: Fix pg_dump for inherited validated not-null constraints |