Skip to content

Commit 4477dcb

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 501c66c commit 4477dcb

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

contrib/pageinspect/brinfuncs.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -355,15 +355,15 @@ brin_revmap_data(PG_FUNCTION_ARGS)
355355
MemoryContext mctx;
356356
Page page;
357357

358-
/* minimally verify the page we got */
359-
page = verify_brin_page(raw_page, BRIN_PAGETYPE_REVMAP, "revmap");
360-
361358
/* create a function context for cross-call persistence */
362359
fctx = SRF_FIRSTCALL_INIT();
363360

364361
/* switch to memory context appropriate for multiple function calls */
365362
mctx = MemoryContextSwitchTo(fctx->multi_call_memory_ctx);
366363

364+
/* minimally verify the page we got */
365+
page = verify_brin_page(raw_page, BRIN_PAGETYPE_REVMAP, "revmap");
366+
367367
state = palloc(sizeof(*state));
368368
state->tids = ((RevmapContents *) PageGetContents(page))->rm_tids;
369369
state->idx = 0;

0 commit comments

Comments
 (0)