diff options
author | Alexander Korotkov <akorotkov@postgresql.org> | 2024-05-23 02:12:45 +0300 |
---|---|---|
committer | Alexander Korotkov <akorotkov@postgresql.org> | 2024-05-23 02:12:45 +0300 |
commit | 0b5c161248110b164a3333006004c78f9529a109 (patch) | |
tree | 37cc1ef8b5e2eec58028199022f04184581ddecb /src/backend/commands/tablecmds.c | |
parent | 532d94fec32ac11263b53932365560491d1fd50a (diff) | |
download | postgresql-0b5c161248110b164a3333006004c78f9529a109.tar.gz postgresql-0b5c161248110b164a3333006004c78f9529a109.zip |
amcheck: Don't load the right sibling page into BtreeCheckState
5ae2087202 implemented a cross-page unique constraint check by loading
the right sibling to the BtreeCheckState.target variable. This is wrong,
because bt_target_page_check() shouldn't change the target page. Also,
BtreeCheckState.target shouldn't be changed alone without
BtreeCheckState.targetblock.
However, the above didn't cause any visible bugs for the following reasons.
1. We do a cross-page unique constraint check only for leaf index pages.
2. The only way target page get accessed after a cross-page unique constraint
check is loading of the lowkey.
3. The only place lowkey is used is bt_child_highkey_check(), and that applies
only to non-leafs.
The reasons above don't diminish the fact that changing BtreeCheckState.target
for a cross-page unique constraint check is wrong. This commit changes this
check to temporarily store the right sibling to the local variable.
Reported-by: Peter Geoghegan
Discussion: https://postgr.es/m/CAH2-Wzk%2B2116uOXdOViA27SHcr31WKPgmjsxXLBs_aTxAeThzg%40mail.gmail.com
Author: Pavel Borisov
Diffstat (limited to 'src/backend/commands/tablecmds.c')
0 files changed, 0 insertions, 0 deletions