Remove overzealous index deletion assertion.
authorPeter Geoghegan <pg@bowt.ie>
Mon, 20 Sep 2021 21:26:25 +0000 (14:26 -0700)
committerPeter Geoghegan <pg@bowt.ie>
Mon, 20 Sep 2021 21:26:25 +0000 (14:26 -0700)
A broken HOT chain is not an unexpected condition, even when the offset
number points past the end of the page's line pointer array.
heap_prune_chain() does not (and never has) treated this condition as
unexpected, so derivative code in heap_index_delete_tuples() shouldn't
do so either.

Oversight in commit 4228817449.

The assertion can probably only fail on Postgres 14 and master.  Earlier
releases don't have commit 3c3b8a4b, which taught VACUUM to truncate the
line pointer array of heap pages.  Backpatch all the same, just to be
consistent.

Author: Peter Geoghegan <pg@bowt.ie>
Reported-By: Alexander Lakhin <exclusion@gmail.com>
Discussion: https://postgr.es/m/17197-9438f31f46705182@postgresql.org
Backpatch: 12-, just like commit 4228817449.

src/backend/access/heap/heapam.c

index 2433998f39bdb8170f20b3a8b5c650c7ae351646..972fdbcb92f1088905f03f6fc554f25ace212ef5 100644 (file)
@@ -7485,10 +7485,7 @@ heap_index_delete_tuples(Relation rel, TM_IndexDeleteOp *delstate)
 
                        /* Some sanity checks */
                        if (offnum < FirstOffsetNumber || offnum > maxoff)
-                       {
-                               Assert(false);
                                break;
-                       }
 
                        lp = PageGetItemId(page, offnum);
                        if (ItemIdIsRedirected(lp))