The following bug has been logged on the website:
Bug reference: 18785
Logged by: Daniel Elishakov
Email address: dan-eli@mail.ru
PostgreSQL version: 16.6
Operating system: ubuntu 20.04
Description:
Hello, I suggest the following patch for this issue.
@@ -905,6 +905,8 @@ ExtendBufferedRelTo(BufferManagerRelation bmr,
bmr.smgr->smgr_cached_nblocks[fork] == InvalidBlockNumber)
&&
!smgrexists(bmr.smgr, fork))
{
+
+ Assert(bmr.rel != NULL);
LockRelationForExtension(bmr.rel, ExclusiveLock);
/* could have been closed while waiting for lock */
I think we need to check bmr.rel for NULL, because Asserts above do not
suggest bmr.rel != NULL. Moreover, it is being checked for NULL later after
being passed into function LockRelationForExtension(bmr.rel, ExclusiveLock);