PostgreSQL Source Code  git master
pageinspect.h File Reference
#include "storage/bufpage.h"
Include dependency graph for pageinspect.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum  pageinspect_version { PAGEINSPECT_V1_8 , PAGEINSPECT_V1_9 }
 

Functions

Page get_page_from_raw (bytea *raw_page)
 

Enumeration Type Documentation

◆ pageinspect_version

Enumerator
PAGEINSPECT_V1_8 
PAGEINSPECT_V1_9 

Definition at line 21 of file pageinspect.h.

22 {
25 };
@ PAGEINSPECT_V1_9
Definition: pageinspect.h:24
@ PAGEINSPECT_V1_8
Definition: pageinspect.h:23

Function Documentation

◆ get_page_from_raw()

Page get_page_from_raw ( bytea raw_page)

Definition at line 215 of file rawpage.c.

216 {
217  Page page;
218  int raw_page_size;
219 
220  raw_page_size = VARSIZE_ANY_EXHDR(raw_page);
221 
222  if (raw_page_size != BLCKSZ)
223  ereport(ERROR,
224  (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
225  errmsg("invalid page size"),
226  errdetail("Expected %d bytes, got %d.",
227  BLCKSZ, raw_page_size)));
228 
229  page = palloc(raw_page_size);
230 
231  memcpy(page, VARDATA_ANY(raw_page), raw_page_size);
232 
233  return page;
234 }
Pointer Page
Definition: bufpage.h:78
int errdetail(const char *fmt,...)
Definition: elog.c:1042
int errcode(int sqlerrcode)
Definition: elog.c:698
int errmsg(const char *fmt,...)
Definition: elog.c:909
#define ERROR
Definition: elog.h:33
#define ereport(elevel,...)
Definition: elog.h:143
void * palloc(Size size)
Definition: mcxt.c:1062
#define VARDATA_ANY(PTR)
Definition: postgres.h:361
#define VARSIZE_ANY_EXHDR(PTR)
Definition: postgres.h:354

References ereport, errcode(), errdetail(), errmsg(), ERROR, palloc(), VARDATA_ANY, and VARSIZE_ANY_EXHDR.

Referenced by gin_leafpage_items(), gin_metapage_info(), gin_page_opaque_info(), gist_page_items(), gist_page_items_bytea(), gist_page_opaque_info(), and verify_hash_page().