1 <!-- doc/src/sgml/pglogicalinspect.sgml -->
3 <sect1 id=
"pglogicalinspect" xreflabel=
"pg_logicalinspect">
4 <title>pg_logicalinspect
— logical decoding components inspection
</title>
6 <indexterm zone=
"pglogicalinspect">
7 <primary>pg_logicalinspect
</primary>
11 The
<filename>pg_logicalinspect
</filename> module provides SQL functions
12 that allow you to inspect the contents of logical decoding components. It
13 allows the inspection of serialized logical snapshots of a running
14 <productname>PostgreSQL
</productname> database cluster, which is useful
15 for debugging or educational purposes.
19 By default, use of these functions is restricted to superusers and members of
20 the
<literal>pg_read_server_files
</literal> role. Access may be granted by
21 superusers to others using
<command>GRANT
</command>.
24 <sect2 id=
"pglogicalinspect-funcs">
25 <title>Functions
</title>
28 <varlistentry id=
"pglogicalinspect-funcs-pg-get-logical-snapshot-meta">
30 <function>pg_get_logical_snapshot_meta(filename text) returns record
</function>
35 Gets logical snapshot metadata about a snapshot file that is located in
36 the server's
<filename>pg_logical/snapshots
</filename> directory.
37 The
<replaceable>filename
</replaceable> argument represents the snapshot
41 postgres=# SELECT * FROM pg_ls_logicalsnapdir();
42 -[ RECORD
1 ]+-----------------------
43 name |
0-
40796E18.snap
45 modification |
2024-
08-
14 16:
36:
32+
00
47 postgres=# SELECT * FROM pg_get_logical_snapshot_meta('
0-
40796E18.snap');
53 postgres=# SELECT ss.name, meta.* FROM pg_ls_logicalsnapdir() AS ss,
54 pg_get_logical_snapshot_meta(ss.name) AS meta;
55 -[ RECORD
1 ]-------------
56 name |
0-
40796E18.snap
63 If
<replaceable>filename
</replaceable> does not match a snapshot file, the
64 function raises an error.
69 <varlistentry id=
"pglogicalinspect-funcs-pg-get-logical-snapshot-info">
71 <function>pg_get_logical_snapshot_info(filename text) returns record
</function>
76 Gets logical snapshot information about a snapshot file that is located in
77 the server's
<filename>pg_logical/snapshots
</filename> directory.
78 The
<replaceable>filename
</replaceable> argument represents the snapshot
82 postgres=# SELECT * FROM pg_ls_logicalsnapdir();
83 -[ RECORD
1 ]+-----------------------
84 name |
0-
40796E18.snap
86 modification |
2024-
08-
14 16:
36:
32+
00
88 postgres=# SELECT * FROM pg_get_logical_snapshot_info('
0-
40796E18.snap');
89 -[ RECORD
1 ]------------+-----------
93 start_decoding_at |
0/
40796AF8
94 two_phase_at |
0/
40796AF8
95 initial_xmin_horizon |
0
96 building_full_snapshot | f
98 last_serialized_snapshot |
0/
0
103 catchange_xip | {
751,
752}
105 postgres=# SELECT ss.name, info.* FROM pg_ls_logicalsnapdir() AS ss,
106 pg_get_logical_snapshot_info(ss.name) AS info;
107 -[ RECORD
1 ]------------+----------------
108 name |
0-
40796E18.snap
112 start_decoding_at |
0/
40796AF8
113 two_phase_at |
0/
40796AF8
114 initial_xmin_horizon |
0
115 building_full_snapshot | f
117 last_serialized_snapshot |
0/
0
122 catchange_xip | {
751,
752}
126 If
<replaceable>filename
</replaceable> does not match a snapshot file, the
127 function raises an error.
135 <sect2 id=
"pglogicalinspect-author">
136 <title>Author
</title>
139 Bertrand Drouvot
<email>bertranddrouvot.pg@gmail.com
</email>