]> granicus.if.org Git - postgresql/blobdiff - contrib/pageinspect/rawpage.c
Update copyrights for 2013
[postgresql] / contrib / pageinspect / rawpage.c
index f341a7247d1ac59f6f5581b4a07ba8cb92db268c..222e043368b11d76bb0ff9d68610117027e26351 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Access-method specific inspection functions are in separate files.
  *
- * Copyright (c) 2007-2010, PostgreSQL Global Development Group
+ * Copyright (c) 2007-2013, PostgreSQL Global Development Group
  *
  * IDENTIFICATION
  *       contrib/pageinspect/rawpage.c
 
 #include "postgres.h"
 
-#include "access/heapam.h"
-#include "access/transam.h"
+#include "access/htup_details.h"
 #include "catalog/catalog.h"
 #include "catalog/namespace.h"
-#include "catalog/pg_type.h"
-#include "fmgr.h"
 #include "funcapi.h"
 #include "miscadmin.h"
 #include "storage/bufmgr.h"
 #include "utils/builtins.h"
+#include "utils/rel.h"
 
 PG_MODULE_MAGIC;
 
@@ -119,6 +117,11 @@ get_raw_page_internal(text *relname, ForkNumber forknum, BlockNumber blkno)
                                (errcode(ERRCODE_WRONG_OBJECT_TYPE),
                                 errmsg("cannot get raw page from composite type \"%s\"",
                                                RelationGetRelationName(rel))));
+       if (rel->rd_rel->relkind == RELKIND_FOREIGN_TABLE)
+               ereport(ERROR,
+                               (errcode(ERRCODE_WRONG_OBJECT_TYPE),
+                                errmsg("cannot get raw page from foreign table \"%s\"",
+                                               RelationGetRelationName(rel))));
 
        /*
         * Reject attempts to read non-local temporary relations; we would be
@@ -204,7 +207,8 @@ page_header(PG_FUNCTION_ARGS)
        /* Extract information from the page header */
 
        lsn = PageGetLSN(page);
-       snprintf(lsnchar, sizeof(lsnchar), "%X/%X", lsn.xlogid, lsn.xrecoff);
+       snprintf(lsnchar, sizeof(lsnchar), "%X/%X",
+                        (uint32) (lsn >> 32), (uint32) lsn);
 
        values[0] = CStringGetTextDatum(lsnchar);
        values[1] = UInt16GetDatum(PageGetTLI(page));