diff options
Diffstat (limited to 'contrib/pageinspect/brinfuncs.c')
-rw-r--r-- | contrib/pageinspect/brinfuncs.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/contrib/pageinspect/brinfuncs.c b/contrib/pageinspect/brinfuncs.c index 22621d584fa..6f719352dda 100644 --- a/contrib/pageinspect/brinfuncs.c +++ b/contrib/pageinspect/brinfuncs.c @@ -117,6 +117,8 @@ verify_brin_page(bytea *raw_page, uint16 type, const char *strtype) return page; } +/* Number of output arguments (columns) for brin_page_items() */ +#define BRIN_PAGE_ITEMS_V1_12 8 /* * Extract all item values from a BRIN index page @@ -145,6 +147,21 @@ brin_page_items(PG_FUNCTION_ARGS) InitMaterializedSRF(fcinfo, 0); + /* + * Version 1.12 added a new output column for the empty range flag. But as + * it was added in the middle, it may cause crashes with function + * definitions from older versions of the extension. + * + * There is no way to reliably avoid the problems created by the old + * function definition at this point, so insist that the user update the + * extension. + */ + if (rsinfo->setDesc->natts < BRIN_PAGE_ITEMS_V1_12) + ereport(ERROR, + (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION), + errmsg("function has wrong number of declared columns"), + errhint("To resolve the problem, update the \"pageinspect\" extension to the latest version."))); + indexRel = index_open(indexRelid, AccessShareLock); if (!IS_BRIN(indexRel)) |