LCOV - differential code coverage report
Current view: top level - contrib/pageinspect - rawpage.c (source / functions) Coverage Total Hit UNC UBC GNC CBC DUB DCB
Current: 4b3c9325757dfd8f2312e9f1a8decf4431f344ae vs e87b024bfb8dd55e3049b1b6e6ab4e810cf1abc8 Lines: 91.1 % 123 112 2 9 12 100 1 8
Current Date: 2026-11-28 16:48:44 +0900 Functions: 100.0 % 19 19 3 16
Baseline: lcov-20261128-baseline Branches: 53.7 % 95 51 8 36 6 45
Baseline Date: 2026-11-28 16:48:48 +0900 Line coverage date bins:
Legend: Lines:     hit not hit
Branches: + taken - not taken # not executed
(7,30] days: 71.4 % 7 5 2 5
(30,360] days: 100.0 % 8 8 7 1
(360..) days: 91.7 % 108 99 9 99
Function coverage date bins:
(7,30] days: 100.0 % 1 1 1
(360..) days: 100.0 % 18 18 2 16
Branch coverage date bins:
(7,30] days: 42.9 % 14 6 8 6
(360..) days: 55.6 % 81 45 36 45

 Age         Owner                    Branch data    TLA  Line data    Source code
                                  1                 :                : /*-------------------------------------------------------------------------
                                  2                 :                :  *
                                  3                 :                :  * rawpage.c
                                  4                 :                :  *    Functions to extract a raw page as bytea and inspect it
                                  5                 :                :  *
                                  6                 :                :  * Access-method specific inspection functions are in separate files.
                                  7                 :                :  *
                                  8                 :                :  * Copyright (c) 2007-2026, PostgreSQL Global Development Group
                                  9                 :                :  *
                                 10                 :                :  * IDENTIFICATION
                                 11                 :                :  *    contrib/pageinspect/rawpage.c
                                 12                 :                :  *
                                 13                 :                :  *-------------------------------------------------------------------------
                                 14                 :                :  */
                                 15                 :                : 
                                 16                 :                : #include "postgres.h"
                                 17                 :                : 
                                 18                 :                : #include "access/htup_details.h"
                                 19                 :                : #include "access/relation.h"
                                 20                 :                : #include "access/xlog.h"
                                 21                 :                : #include "catalog/namespace.h"
                                 22                 :                : #include "catalog/pg_type.h"
                                 23                 :                : #include "funcapi.h"
                                 24                 :                : #include "miscadmin.h"
                                 25                 :                : #include "pageinspect.h"
                                 26                 :                : #include "storage/bufmgr.h"
                                 27                 :                : #include "storage/checksum.h"
                                 28                 :                : #include "utils/builtins.h"
                                 29                 :                : #include "utils/pg_lsn.h"
                                 30                 :                : #include "utils/rel.h"
                                 31                 :                : #include "utils/varlena.h"
                                 32                 :                : 
  612 tgl@sss.pgh.pa.us          33                 :CBC          26 : PG_MODULE_MAGIC_EXT(
                                 34                 :                :                     .name = "pageinspect",
                                 35                 :                :                     .version = PG_VERSION
                                 36                 :                : );
                                 37                 :                : 
                                 38                 :                : static bytea *get_raw_page_internal(text *relname, ForkNumber forknum,
                                 39                 :                :                                     BlockNumber blkno);
                                 40                 :                : 
                                 41                 :                : 
                                 42                 :                : /*
                                 43                 :                :  * get_raw_page
                                 44                 :                :  *
                                 45                 :                :  * Returns a copy of a page from shared buffers as a bytea
                                 46                 :                :  */
 2139 peter@eisentraut.org       47                 :             26 : PG_FUNCTION_INFO_V1(get_raw_page_1_9);
                                 48                 :                : 
                                 49                 :                : Datum
                                 50                 :            137 : get_raw_page_1_9(PG_FUNCTION_ARGS)
                                 51                 :                : {
                                 52                 :            137 :     text       *relname = PG_GETARG_TEXT_PP(0);
                                 53                 :            137 :     int64       blkno = PG_GETARG_INT64(1);
                                 54                 :                :     bytea      *raw_page;
                                 55                 :                : 
                                 56   [ +  +  -  + ]:            137 :     if (blkno < 0 || blkno > MaxBlockNumber)
                                 57         [ +  - ]:              1 :         ereport(ERROR,
                                 58                 :                :                 (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
                                 59                 :                :                  errmsg("invalid block number")));
                                 60                 :                : 
                                 61                 :            136 :     raw_page = get_raw_page_internal(relname, MAIN_FORKNUM, blkno);
                                 62                 :                : 
                                 63                 :            131 :     PG_RETURN_BYTEA_P(raw_page);
                                 64                 :                : }
                                 65                 :                : 
                                 66                 :                : /*
                                 67                 :                :  * entry point for old extension version
                                 68                 :                :  */
 7135 bruce@momjian.us           69                 :              9 : PG_FUNCTION_INFO_V1(get_raw_page);
                                 70                 :                : 
                                 71                 :                : Datum
                                 72                 :              2 : get_raw_page(PG_FUNCTION_ARGS)
                                 73                 :                : {
 3548 noah@leadboat.com          74                 :              2 :     text       *relname = PG_GETARG_TEXT_PP(0);
 6382 tgl@sss.pgh.pa.us          75                 :              2 :     uint32      blkno = PG_GETARG_UINT32(1);
                                 76                 :                :     bytea      *raw_page;
                                 77                 :                : 
                                 78                 :                :     /*
                                 79                 :                :      * We don't normally bother to check the number of arguments to a C
                                 80                 :                :      * function, but here it's needed for safety because early 8.4 beta
                                 81                 :                :      * releases mistakenly redefined get_raw_page() as taking three arguments.
                                 82                 :                :      */
                                 83         [ -  + ]:              2 :     if (PG_NARGS() != 2)
 6382 tgl@sss.pgh.pa.us          84         [ #  # ]:UBC           0 :         ereport(ERROR,
                                 85                 :                :                 (errmsg("wrong number of arguments to get_raw_page()"),
                                 86                 :                :                  errhint("Run the updated pageinspect.sql script.")));
                                 87                 :                : 
 6382 tgl@sss.pgh.pa.us          88                 :CBC           2 :     raw_page = get_raw_page_internal(relname, MAIN_FORKNUM, blkno);
                                 89                 :                : 
                                 90                 :              2 :     PG_RETURN_BYTEA_P(raw_page);
                                 91                 :                : }
                                 92                 :                : 
                                 93                 :                : /*
                                 94                 :                :  * get_raw_page_fork
                                 95                 :                :  *
                                 96                 :                :  * Same, for any fork
                                 97                 :                :  */
 2139 peter@eisentraut.org       98                 :             10 : PG_FUNCTION_INFO_V1(get_raw_page_fork_1_9);
                                 99                 :                : 
                                100                 :                : Datum
                                101                 :             12 : get_raw_page_fork_1_9(PG_FUNCTION_ARGS)
                                102                 :                : {
                                103                 :             12 :     text       *relname = PG_GETARG_TEXT_PP(0);
                                104                 :             12 :     text       *forkname = PG_GETARG_TEXT_PP(1);
                                105                 :             12 :     int64       blkno = PG_GETARG_INT64(2);
                                106                 :                :     bytea      *raw_page;
                                107                 :                :     ForkNumber  forknum;
                                108                 :                : 
                                109                 :             12 :     forknum = forkname_to_number(text_to_cstring(forkname));
                                110                 :                : 
                                111   [ +  +  -  + ]:             11 :     if (blkno < 0 || blkno > MaxBlockNumber)
                                112         [ +  - ]:              1 :         ereport(ERROR,
                                113                 :                :                 (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
                                114                 :                :                  errmsg("invalid block number")));
                                115                 :                : 
                                116                 :             10 :     raw_page = get_raw_page_internal(relname, forknum, blkno);
                                117                 :                : 
                                118                 :              7 :     PG_RETURN_BYTEA_P(raw_page);
                                119                 :                : }
                                120                 :                : 
                                121                 :                : /*
                                122                 :                :  * Entry point for old extension version
                                123                 :                :  */
 6382 tgl@sss.pgh.pa.us         124                 :              9 : PG_FUNCTION_INFO_V1(get_raw_page_fork);
                                125                 :                : 
                                126                 :                : Datum
                                127                 :              1 : get_raw_page_fork(PG_FUNCTION_ARGS)
                                128                 :                : {
 3548 noah@leadboat.com         129                 :              1 :     text       *relname = PG_GETARG_TEXT_PP(0);
                                130                 :              1 :     text       *forkname = PG_GETARG_TEXT_PP(1);
 6633 heikki.linnakangas@i      131                 :              1 :     uint32      blkno = PG_GETARG_UINT32(2);
                                132                 :                :     bytea      *raw_page;
                                133                 :                :     ForkNumber  forknum;
                                134                 :                : 
 6382 tgl@sss.pgh.pa.us         135                 :              1 :     forknum = forkname_to_number(text_to_cstring(forkname));
                                136                 :                : 
                                137                 :              1 :     raw_page = get_raw_page_internal(relname, forknum, blkno);
                                138                 :                : 
                                139                 :              1 :     PG_RETURN_BYTEA_P(raw_page);
                                140                 :                : }
                                141                 :                : 
                                142                 :                : /*
                                143                 :                :  * workhorse
                                144                 :                :  */
                                145                 :                : static bytea *
                                146                 :            149 : get_raw_page_internal(text *relname, ForkNumber forknum, BlockNumber blkno)
                                147                 :                : {
                                148                 :                :     bytea      *raw_page;
                                149                 :                :     RangeVar   *relrv;
                                150                 :                :     Relation    rel;
                                151                 :                :     char       *raw_page_data;
                                152                 :                :     Buffer      buf;
                                153                 :                : 
 7135 bruce@momjian.us          154         [ -  + ]:            149 :     if (!superuser())
 7135 bruce@momjian.us          155         [ #  # ]:UBC           0 :         ereport(ERROR,
                                156                 :                :                 (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
                                157                 :                :                  errmsg("must be superuser to use raw page functions")));
                                158                 :                : 
 7135 bruce@momjian.us          159                 :CBC         149 :     relrv = makeRangeVarFromNameList(textToQualifiedNameList(relname));
                                160                 :            149 :     rel = relation_openrv(relrv, AccessShareLock);
                                161                 :                : 
 1969 peter@eisentraut.org      162   [ +  +  +  +  :            148 :     if (!RELKIND_HAS_STORAGE(rel->rd_rel->relkind))
                                     +  +  +  -  +  
                                                 - ]
 7135 bruce@momjian.us          163         [ +  - ]:              2 :         ereport(ERROR,
                                164                 :                :                 (errcode(ERRCODE_WRONG_OBJECT_TYPE),
                                165                 :                :                  errmsg("cannot get raw page from relation \"%s\"",
                                166                 :                :                         RelationGetRelationName(rel)),
                                167                 :                :                  errdetail_relkind_not_supported(rel->rd_rel->relkind)));
                                168                 :                : 
   19 michael@paquier.xyz       169                 :GNC         146 :     check_relation_supported(rel, forknum);
                                170                 :                : 
 4512 tgl@sss.pgh.pa.us         171         [ +  + ]:CBC         146 :     if (blkno >= RelationGetNumberOfBlocksInFork(rel, forknum))
                                172         [ +  - ]:              5 :         ereport(ERROR,
                                173                 :                :                 (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
                                174                 :                :                  errmsg("block number %u is out of range for relation \"%s\"",
                                175                 :                :                         blkno, RelationGetRelationName(rel))));
                                176                 :                : 
                                177                 :                :     /* Initialize buffer to copy to */
 7135 bruce@momjian.us          178                 :            141 :     raw_page = (bytea *) palloc(BLCKSZ + VARHDRSZ);
                                179                 :            141 :     SET_VARSIZE(raw_page, BLCKSZ + VARHDRSZ);
                                180                 :            141 :     raw_page_data = VARDATA(raw_page);
                                181                 :                : 
                                182                 :                :     /* Take a verbatim copy of the page */
                                183                 :                : 
 6602 heikki.linnakangas@i      184                 :            141 :     buf = ReadBufferExtended(rel, forknum, blkno, RBM_NORMAL, NULL);
 7135 bruce@momjian.us          185                 :            141 :     LockBuffer(buf, BUFFER_LOCK_SHARE);
                                186                 :                : 
 3874 kgrittn@postgresql.o      187                 :            141 :     memcpy(raw_page_data, BufferGetPage(buf), BLCKSZ);
                                188                 :                : 
  246 andres@anarazel.de        189                 :            141 :     UnlockReleaseBuffer(buf);
                                190                 :                : 
 7135 bruce@momjian.us          191                 :            141 :     relation_close(rel, AccessShareLock);
                                192                 :                : 
 6382 tgl@sss.pgh.pa.us         193                 :            141 :     return raw_page;
                                194                 :                : }
                                195                 :                : 
                                196                 :                : /*
                                197                 :                :  * check_relation_supported
                                198                 :                :  *
                                199                 :                :  * Check that the given fork of a relation can be read by this session.
                                200                 :                :  */
                                201                 :                : void
   19 michael@paquier.xyz       202                 :GNC         171 : check_relation_supported(Relation rel, ForkNumber forknum)
                                203                 :                : {
                                204                 :                :     /*
                                205                 :                :      * Reject attempts to read non-local temporary relations; we would be
                                206                 :                :      * likely to get wrong data since we have no visibility into the owning
                                207                 :                :      * session's local buffers.
                                208                 :                :      */
                                209   [ +  +  -  + ]:            171 :     if (RELATION_IS_OTHER_TEMP(rel))
   19 michael@paquier.xyz       210         [ #  # ]:UNC           0 :         ereport(ERROR,
                                211                 :                :                 (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
                                212                 :                :                  errmsg("cannot access temporary tables of other sessions")));
                                213                 :                : 
                                214                 :                :     /*
                                215                 :                :      * Temporary and unlogged relations are inaccessible during recovery,
                                216                 :                :      * except for the init fork of an unlogged relation, which does exist.
                                217                 :                :      */
   19 michael@paquier.xyz       218   [ +  +  -  +  :GNC         171 :     if (!RelationIsPermanent(rel) && RecoveryInProgress() &&
                                              -  - ]
                                219                 :                :         forknum != INIT_FORKNUM)
   19 michael@paquier.xyz       220         [ #  # ]:UNC           0 :         ereport(ERROR,
                                221                 :                :                 (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
                                222                 :                :                  errmsg("cannot access temporary or unlogged relations during recovery")));
   19 michael@paquier.xyz       223                 :GNC         171 : }
                                224                 :                : 
                                225                 :                : /*
                                226                 :                :  * get_page_from_raw
                                227                 :                :  *
                                228                 :                :  * Get a palloc'd, maxalign'ed page image from the result of get_raw_page()
                                229                 :                :  *
                                230                 :                :  * On machines with MAXALIGN = 8, the payload of a bytea is not maxaligned,
                                231                 :                :  * since it will start 4 bytes into a palloc'd value.  PageHeaderData requires
                                232                 :                :  * 8 byte alignment, so always use this function when accessing page header
                                233                 :                :  * fields from a raw page bytea.
                                234                 :                :  */
                                235                 :                : Page
 3585 tgl@sss.pgh.pa.us         236                 :CBC         179 : get_page_from_raw(bytea *raw_page)
                                237                 :                : {
                                238                 :                :     Page        page;
                                239                 :                :     int         raw_page_size;
                                240                 :                : 
 3548 noah@leadboat.com         241                 :            179 :     raw_page_size = VARSIZE_ANY_EXHDR(raw_page);
                                242                 :                : 
 3585 tgl@sss.pgh.pa.us         243         [ +  + ]:            179 :     if (raw_page_size != BLCKSZ)
                                244         [ +  - ]:             14 :         ereport(ERROR,
                                245                 :                :                 (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
                                246                 :                :                  errmsg("invalid page size"),
                                247                 :                :                  errdetail("Expected %d bytes, got %d.",
                                248                 :                :                            BLCKSZ, raw_page_size)));
                                249                 :                : 
                                250                 :            165 :     page = palloc(raw_page_size);
                                251                 :                : 
 3548 noah@leadboat.com         252                 :            165 :     memcpy(page, VARDATA_ANY(raw_page), raw_page_size);
                                253                 :                : 
 3585 tgl@sss.pgh.pa.us         254                 :            165 :     return page;
                                255                 :                : }
                                256                 :                : 
                                257                 :                : 
                                258                 :                : /*
                                259                 :                :  * page_header
                                260                 :                :  *
                                261                 :                :  * Allows inspection of page header fields of a raw page
                                262                 :                :  */
                                263                 :                : 
 7135 bruce@momjian.us          264                 :             19 : PG_FUNCTION_INFO_V1(page_header);
                                265                 :                : 
                                266                 :                : Datum
                                267                 :              5 : page_header(PG_FUNCTION_ARGS)
                                268                 :                : {
                                269                 :              5 :     bytea      *raw_page = PG_GETARG_BYTEA_P(0);
                                270                 :                : 
                                271                 :                :     TupleDesc   tupdesc;
                                272                 :                : 
                                273                 :                :     Datum       result;
                                274                 :                :     HeapTuple   tuple;
                                275                 :                :     Datum       values[9];
                                276                 :                :     bool        nulls[9];
                                277                 :                : 
                                278                 :                :     Page        page;
                                279                 :                :     PageHeader  pageheader;
                                280                 :                :     XLogRecPtr  lsn;
                                281                 :                : 
                                282         [ -  + ]:              5 :     if (!superuser())
 7135 bruce@momjian.us          283         [ #  # ]:UBC           0 :         ereport(ERROR,
                                284                 :                :                 (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
                                285                 :                :                  errmsg("must be superuser to use raw page functions")));
                                286                 :                : 
 1601 peter@eisentraut.org      287                 :CBC           5 :     page = get_page_from_raw(raw_page);
                                288                 :              4 :     pageheader = (PageHeader) page;
                                289                 :                : 
                                290                 :                :     /* Build a tuple descriptor for our result type */
 7135 bruce@momjian.us          291         [ -  + ]:              4 :     if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
 7135 bruce@momjian.us          292         [ #  # ]:UBC           0 :         elog(ERROR, "return type must be a row type");
                                293                 :                : 
                                294                 :                :     /* Extract information from the page header */
                                295                 :                : 
 7135 bruce@momjian.us          296                 :CBC           4 :     lsn = PageGetLSN(page);
                                297                 :                : 
                                298                 :                :     /* pageinspect >= 1.2 uses pg_lsn instead of text for the LSN field. */
 3387 andres@anarazel.de        299         [ -  + ]:              4 :     if (TupleDescAttr(tupdesc, 0)->atttypid == TEXTOID)
                                300                 :                :     {
                                301                 :                :         char        lsnchar[64];
                                302                 :                : 
  509 alvherre@kurilemu.de      303                 :UBC           0 :         snprintf(lsnchar, sizeof(lsnchar), "%X/%08X", LSN_FORMAT_ARGS(lsn));
 4653 rhaas@postgresql.org      304                 :              0 :         values[0] = CStringGetTextDatum(lsnchar);
                                305                 :                :     }
                                306                 :                :     else
 4653 rhaas@postgresql.org      307                 :CBC           4 :         values[0] = LSNGetDatum(lsn);
  143 michael@paquier.xyz       308                 :GNC           4 :     values[1] = Int16GetDatum(pageheader->pd_checksum);
                                309                 :              4 :     values[2] = Int16GetDatum(pageheader->pd_flags);
                                310                 :                : 
                                311                 :                :     /* pageinspect >= 1.10 uses int4 instead of int2 for those fields */
 1965 michael@paquier.xyz       312      [ +  +  - ]:CBC           4 :     switch (TupleDescAttr(tupdesc, 3)->atttypid)
                                313                 :                :     {
                                314                 :              1 :         case INT2OID:
                                315   [ +  -  +  -  :              1 :             Assert(TupleDescAttr(tupdesc, 4)->atttypid == INT2OID &&
                                              -  + ]
                                316                 :                :                    TupleDescAttr(tupdesc, 5)->atttypid == INT2OID &&
                                317                 :                :                    TupleDescAttr(tupdesc, 6)->atttypid == INT2OID);
  143 michael@paquier.xyz       318                 :GNC           1 :             values[3] = Int16GetDatum(pageheader->pd_lower);
                                319                 :              1 :             values[4] = Int16GetDatum(pageheader->pd_upper);
                                320                 :              1 :             values[5] = Int16GetDatum(pageheader->pd_special);
                                321                 :              1 :             values[6] = Int16GetDatum(PageGetPageSize(page));
 1965 michael@paquier.xyz       322                 :CBC           1 :             break;
                                323                 :              3 :         case INT4OID:
                                324   [ +  -  +  -  :              3 :             Assert(TupleDescAttr(tupdesc, 4)->atttypid == INT4OID &&
                                              -  + ]
                                325                 :                :                    TupleDescAttr(tupdesc, 5)->atttypid == INT4OID &&
                                326                 :                :                    TupleDescAttr(tupdesc, 6)->atttypid == INT4OID);
 1601 peter@eisentraut.org      327                 :              3 :             values[3] = Int32GetDatum(pageheader->pd_lower);
                                328                 :              3 :             values[4] = Int32GetDatum(pageheader->pd_upper);
                                329                 :              3 :             values[5] = Int32GetDatum(pageheader->pd_special);
 1965 michael@paquier.xyz       330                 :              3 :             values[6] = Int32GetDatum(PageGetPageSize(page));
                                331                 :              3 :             break;
 1965 michael@paquier.xyz       332                 :UBC           0 :         default:
                                333         [ #  # ]:              0 :             elog(ERROR, "incorrect output types");
                                334                 :                :             break;
                                335                 :                :     }
                                336                 :                : 
  143 michael@paquier.xyz       337                 :GNC           4 :     values[7] = Int16GetDatum(PageGetPageLayoutVersion(page));
 1601 peter@eisentraut.org      338                 :CBC           4 :     values[8] = TransactionIdGetDatum(pageheader->pd_prune_xid);
                                339                 :                : 
                                340                 :                :     /* Build and return the tuple. */
                                341                 :                : 
 7135 bruce@momjian.us          342                 :              4 :     memset(nulls, 0, sizeof(nulls));
                                343                 :                : 
 6953                           344                 :              4 :     tuple = heap_form_tuple(tupdesc, values, nulls);
                                345                 :              4 :     result = HeapTupleGetDatum(tuple);
                                346                 :                : 
 7135                           347                 :              4 :     PG_RETURN_DATUM(result);
                                348                 :                : }
                                349                 :                : 
                                350                 :                : /*
                                351                 :                :  * page_checksum
                                352                 :                :  *
                                353                 :                :  * Compute checksum of a raw page
                                354                 :                :  */
                                355                 :                : 
 2139 peter@eisentraut.org      356                 :             10 : PG_FUNCTION_INFO_V1(page_checksum_1_9);
 3543 peter_e@gmx.net           357                 :              9 : PG_FUNCTION_INFO_V1(page_checksum);
                                358                 :                : 
                                359                 :                : static Datum
 2139 peter@eisentraut.org      360                 :             23 : page_checksum_internal(PG_FUNCTION_ARGS, enum pageinspect_version ext_version)
                                361                 :                : {
 3543 peter_e@gmx.net           362                 :             23 :     bytea      *raw_page = PG_GETARG_BYTEA_P(0);
 2139 peter@eisentraut.org      363         [ +  + ]:             23 :     int64       blkno = (ext_version == PAGEINSPECT_V1_8 ? PG_GETARG_UINT32(1) : PG_GETARG_INT64(1));
                                364                 :                :     Page        page;
                                365                 :                : 
 3543 peter_e@gmx.net           366         [ -  + ]:             23 :     if (!superuser())
 3543 peter_e@gmx.net           367         [ #  # ]:UBC           0 :         ereport(ERROR,
                                368                 :                :                 (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
                                369                 :                :                  errmsg("must be superuser to use raw page functions")));
                                370                 :                : 
 2139 peter@eisentraut.org      371   [ +  +  -  + ]:CBC          23 :     if (blkno < 0 || blkno > MaxBlockNumber)
                                372         [ +  - ]:              1 :         ereport(ERROR,
                                373                 :                :                 (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
                                374                 :                :                  errmsg("invalid block number")));
                                375                 :                : 
 1718 michael@paquier.xyz       376                 :             22 :     page = get_page_from_raw(raw_page);
                                377                 :                : 
 1689                           378         [ +  + ]:             21 :     if (PageIsNew(page))
                                379                 :              1 :         PG_RETURN_NULL();
                                380                 :                : 
  654 peter@eisentraut.org      381                 :             20 :     PG_RETURN_INT16(pg_checksum_page(page, blkno));
                                382                 :                : }
                                383                 :                : 
                                384                 :                : Datum
 2139                           385                 :             22 : page_checksum_1_9(PG_FUNCTION_ARGS)
                                386                 :                : {
                                387                 :             22 :     return page_checksum_internal(fcinfo, PAGEINSPECT_V1_9);
                                388                 :                : }
                                389                 :                : 
                                390                 :                : /*
                                391                 :                :  * Entry point for old extension version
                                392                 :                :  */
                                393                 :                : Datum
                                394                 :              1 : page_checksum(PG_FUNCTION_ARGS)
                                395                 :                : {
                                396                 :              1 :     return page_checksum_internal(fcinfo, PAGEINSPECT_V1_8);
                                397                 :                : }
        

Generated by: LCOV version 2.0-1