summaryrefslogtreecommitdiff
path: root/contrib/pageinspect/brinfuncs.c
diff options
context:
space:
mode:
authorMichael Paquier2022-03-16 03:29:39 +0000
committerMichael Paquier2022-03-16 03:29:39 +0000
commit4477dcb207c23f808737a5059157a085212f55e9 (patch)
tree70c2a8902564d7ed75d57c646fba2de197701001 /contrib/pageinspect/brinfuncs.c
parent501c66c81b755583fa516c88e1cc7c760dc88bd5 (diff)
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/[email protected] Backpatch-through: 10
Diffstat (limited to 'contrib/pageinspect/brinfuncs.c')
-rw-r--r--contrib/pageinspect/brinfuncs.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/contrib/pageinspect/brinfuncs.c b/contrib/pageinspect/brinfuncs.c
index bd0ea8b18c1..bf12901ac3e 100644
--- a/contrib/pageinspect/brinfuncs.c
+++ b/contrib/pageinspect/brinfuncs.c
@@ -355,15 +355,15 @@ brin_revmap_data(PG_FUNCTION_ARGS)
MemoryContext mctx;
Page page;
- /* minimally verify the page we got */
- page = verify_brin_page(raw_page, BRIN_PAGETYPE_REVMAP, "revmap");
-
/* create a function context for cross-call persistence */
fctx = SRF_FIRSTCALL_INIT();
/* switch to memory context appropriate for multiple function calls */
mctx = MemoryContextSwitchTo(fctx->multi_call_memory_ctx);
+ /* minimally verify the page we got */
+ page = verify_brin_page(raw_page, BRIN_PAGETYPE_REVMAP, "revmap");
+
state = palloc(sizeof(*state));
state->tids = ((RevmapContents *) PageGetContents(page))->rm_tids;
state->idx = 0;