Skip to content

Commit 1d1777f

Browse files
author
Antonin Houska
committed
Check properly if indexes need to be updated.
In PG 16 it's possible to use HOT update even if indexed attributes change - in particular, the attributes of "summarizing" indexes. Therefore, the check for HOT update is not sufficient.
1 parent b50e184 commit 1d1777f

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

NEWS

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,14 @@ Bug fixes
5252
Like with other functions of this extension, the SUPERUSER role attribute
5353
is not needed for execution. The REPLICATION attribute is sufficient.
5454

55+
4. Update BRIN indexes when appropriate.
56+
57+
If a row was updated during the table processing and only the attributes of
58+
"summarizing" (BRIN) indexes changed, pg_squeeze might fail to update those
59+
indexes.
60+
61+
This bug only affects pg_squeeze on PostgreSQL 16.
62+
5563

5664
Release 1.6.1
5765
=============

concurrent.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,21 @@ apply_concurrent_changes(DecodingOutputState *dstate, Relation relation,
416416
&update_indexes
417417
#endif
418418
);
419+
/*
420+
* In PG < 16, change of any indexed attribute makes HOT
421+
* impossible, Therefore HOT update implies that no index
422+
* needs to be updated.
423+
*
424+
* In PG >= 16, if only attributes of "summarizing indexes"
425+
* change, HOT update is still possible. Therefore HOT update
426+
* might still require some indexes (in particular, the
427+
* summarizing ones) to be updated.
428+
*/
429+
#if PG_VERSION_NUM >= 160000
430+
if (update_indexes != TU_None)
431+
#else
419432
if (!HeapTupleIsHeapOnly(tup))
433+
#endif
420434
{
421435
List *recheck;
422436

0 commit comments

Comments
 (0)