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.

Function Documentation

◆ get_page_from_raw()

Page get_page_from_raw ( bytea raw_page)

Definition at line 235 of file rawpage.c.

References ereport, errcode(), errdetail(), errmsg(), ERROR, page_header(), palloc(), PG_FUNCTION_INFO_V1(), 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().

236 {
237  Page page;
238  int raw_page_size;
239 
240  raw_page_size = VARSIZE_ANY_EXHDR(raw_page);
241 
242  if (raw_page_size != BLCKSZ)
243  ereport(ERROR,
244  (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
245  errmsg("invalid page size"),
246  errdetail("Expected %d bytes, got %d.",
247  BLCKSZ, raw_page_size)));
248 
249  page = palloc(raw_page_size);
250 
251  memcpy(page, VARDATA_ANY(raw_page), raw_page_size);
252 
253  return page;
254 }
#define VARDATA_ANY(PTR)
Definition: postgres.h:361
int errcode(int sqlerrcode)
Definition: elog.c:698
#define ERROR
Definition: elog.h:46
int errdetail(const char *fmt,...)
Definition: elog.c:1042
Page page
Definition: btreefuncs.c:290
#define ereport(elevel,...)
Definition: elog.h:157
#define VARSIZE_ANY_EXHDR(PTR)
Definition: postgres.h:354
void * palloc(Size size)
Definition: mcxt.c:1062
int errmsg(const char *fmt,...)
Definition: elog.c:909
Pointer Page
Definition: bufpage.h:78