Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
45ffeb7e
Commit
45ffeb7e
authored
Mar 03, 2014
by
Robert Haas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pageinspect: Use new pg_lsn datatype.
Michael Paquier, with slight comment changes by me
parent
ae95f5f7
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
35 additions
and
9 deletions
+35
-9
contrib/pageinspect/Makefile
contrib/pageinspect/Makefile
+2
-2
contrib/pageinspect/pageinspect--1.1--1.2.sql
contrib/pageinspect/pageinspect--1.1--1.2.sql
+18
-0
contrib/pageinspect/pageinspect--1.2.sql
contrib/pageinspect/pageinspect--1.2.sql
+2
-2
contrib/pageinspect/pageinspect.control
contrib/pageinspect/pageinspect.control
+1
-1
contrib/pageinspect/rawpage.c
contrib/pageinspect/rawpage.c
+12
-4
No files found.
contrib/pageinspect/Makefile
View file @
45ffeb7e
...
...
@@ -4,8 +4,8 @@ MODULE_big = pageinspect
OBJS
=
rawpage.o heapfuncs.o btreefuncs.o fsmfuncs.o
EXTENSION
=
pageinspect
DATA
=
pageinspect--1.
1
.sql pageinspect--1.0--1.1.sql
\
pageinspect--unpackaged--1.0.sql
DATA
=
pageinspect--1.
2
.sql pageinspect--1.0--1.1.sql
\
pageinspect--
1.1--1.2.sql pageinspect--
unpackaged--1.0.sql
ifdef
USE_PGXS
PG_CONFIG
=
pg_config
...
...
contrib/pageinspect/pageinspect--1.1--1.2.sql
0 → 100644
View file @
45ffeb7e
/* contrib/pageinspect/pageinspect--1.1--1.2.sql */
-- complain if script is sourced in psql, rather than via ALTER EXTENSION
\
echo
Use
"ALTER EXTENSION pageinspect UPDATE TO 1.2"
to
load
this
file
.
\
quit
DROP
FUNCTION
page_header
(
bytea
);
CREATE
FUNCTION
page_header
(
IN
page
bytea
,
OUT
lsn
pg_lsn
,
OUT
checksum
smallint
,
OUT
flags
smallint
,
OUT
lower
smallint
,
OUT
upper
smallint
,
OUT
special
smallint
,
OUT
pagesize
smallint
,
OUT
version
smallint
,
OUT
prune_xid
xid
)
AS
'MODULE_PATHNAME'
,
'page_header'
LANGUAGE
C
STRICT
;
contrib/pageinspect/pageinspect--1.
1
.sql
→
contrib/pageinspect/pageinspect--1.
2
.sql
View file @
45ffeb7e
/* contrib/pageinspect/pageinspect--1.
1
.sql */
/* contrib/pageinspect/pageinspect--1.
2
.sql */
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
\
echo
Use
"CREATE EXTENSION pageinspect"
to
load
this
file
.
\
quit
...
...
@@ -20,7 +20,7 @@ LANGUAGE C STRICT;
-- page_header()
--
CREATE
FUNCTION
page_header
(
IN
page
bytea
,
OUT
lsn
text
,
OUT
lsn
pg_lsn
,
OUT
checksum
smallint
,
OUT
flags
smallint
,
OUT
lower
smallint
,
...
...
contrib/pageinspect/pageinspect.control
View file @
45ffeb7e
# pageinspect extension
comment = 'inspect the contents of database pages at a low level'
default_version = '1.
1
'
default_version = '1.
2
'
module_pathname = '$libdir/pageinspect'
relocatable = true
contrib/pageinspect/rawpage.c
View file @
45ffeb7e
...
...
@@ -18,10 +18,12 @@
#include "access/htup_details.h"
#include "catalog/catalog.h"
#include "catalog/namespace.h"
#include "catalog/pg_type.h"
#include "funcapi.h"
#include "miscadmin.h"
#include "storage/bufmgr.h"
#include "utils/builtins.h"
#include "utils/pg_lsn.h"
#include "utils/rel.h"
PG_MODULE_MAGIC
;
...
...
@@ -180,7 +182,6 @@ page_header(PG_FUNCTION_ARGS)
PageHeader
page
;
XLogRecPtr
lsn
;
char
lsnchar
[
64
];
if
(
!
superuser
())
ereport
(
ERROR
,
...
...
@@ -207,10 +208,17 @@ page_header(PG_FUNCTION_ARGS)
/* Extract information from the page header */
lsn
=
PageGetLSN
(
page
);
/* pageinspect >= 1.2 uses pg_lsn instead of text for the LSN field. */
if
(
tupdesc
->
attrs
[
0
]
->
atttypid
==
TEXTOID
)
{
char
lsnchar
[
64
];
snprintf
(
lsnchar
,
sizeof
(
lsnchar
),
"%X/%X"
,
(
uint32
)
(
lsn
>>
32
),
(
uint32
)
lsn
);
values
[
0
]
=
CStringGetTextDatum
(
lsnchar
);
}
else
values
[
0
]
=
LSNGetDatum
(
lsn
);
values
[
1
]
=
UInt16GetDatum
(
page
->
pd_checksum
);
values
[
2
]
=
UInt16GetDatum
(
page
->
pd_flags
);
values
[
3
]
=
UInt16GetDatum
(
page
->
pd_lower
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment