You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
pageinspect: Fix handling of page sizes and AM types
This commit fixes a set of issues related to the use of the SQLfunctions in this module when the caller is able to pass down raw pagedata as input argument:- The page size check was fuzzy in a couple of places, sometimeslooking after only a sub-range, but what we are looking for is an exactmatch on BLCKSZ. After considering a few options here, I have settleddown to do a generalization of get_page_from_raw(). Most of the SQLfunctions already used that, and this is not strictly required if notaccessing an 8-byte-wide value from a raw page, but this feels safer inthe long run for alignment-picky environment, particularly if a codepath begins to access such values. This also reduces the number ofstrings that need to be translated.- The BRIN function brin_page_items() uses a Relation but it did notcheck the access method of the opened index, potentially leading tocrashes. All the other functions in need of a Relation already didthat.- Some code paths could fail on elog(), but we should to use ereport()for failures that can be triggered by the user.Tests are added to stress all the cases that are fixed as of thiscommit, with some junk raw pages (\set VERBOSITY ensures that this worksacross all page sizes) and unexpected index types when functions openrelations.Author: Michael Paquier, Justin PrysbyDiscussion:https://postgr.es/m/20220218030020.GA1137@telsasoft.comBackpatch-through: 10