Skip to content

Commit 028a3c6

Browse files
committed
pageinspect: Fix memory context allocation of page in brin_revmap_data()
This caused the function to fail, as the aligned copy of the raw page given by the function caller was not saved in the correct memory context, which needs to be multi_call_memory_ctx in this case. Issue introduced by 076f4d9. Per buildfarm members sifika, mylodon and longfin. I have reproduced that locally with macos. Discussion: https://postgr.es/m/YjFPOtfCW6yLXUeM@paquier.xyz Backpatch-through: 10
1 parent cfdb303 commit 028a3c6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

contrib/pageinspect/brinfuncs.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -372,15 +372,15 @@ brin_revmap_data(PG_FUNCTION_ARGS)
372372
MemoryContext mctx;
373373
Page page;
374374

375-
/* minimally verify the page we got */
376-
page = verify_brin_page(raw_page, BRIN_PAGETYPE_REVMAP, "revmap");
377-
378375
/* create a function context for cross-call persistence */
379376
fctx = SRF_FIRSTCALL_INIT();
380377

381378
/* switch to memory context appropriate for multiple function calls */
382379
mctx = MemoryContextSwitchTo(fctx->multi_call_memory_ctx);
383380

381+
/* minimally verify the page we got */
382+
page = verify_brin_page(raw_page, BRIN_PAGETYPE_REVMAP, "revmap");
383+
384384
state = palloc(sizeof(*state));
385385
state->tids = ((RevmapContents *) PageGetContents(page))->rm_tids;
386386
state->idx = 0;

0 commit comments

Comments
 (0)