1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>F.28. pg_logicalinspect — logical decoding components inspection</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="pgfreespacemap.html" title="F.27. pg_freespacemap — examine the free space map" /><link rel="next" href="pgoverexplain.html" title="F.29. pg_overexplain — allow EXPLAIN to dump even more details" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">F.28. pg_logicalinspect — logical decoding components inspection</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="pgfreespacemap.html" title="F.27. pg_freespacemap — examine the free space map">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="contrib.html" title="Appendix F. Additional Supplied Modules and Extensions">Up</a></td><th width="60%" align="center">Appendix F. Additional Supplied Modules and Extensions</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 18.0 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="pgoverexplain.html" title="F.29. pg_overexplain — allow EXPLAIN to dump even more details">Next</a></td></tr></table><hr /></div><div class="sect1" id="PGLOGICALINSPECT"><div class="titlepage"><div><div><h2 class="title" style="clear: both">F.28. pg_logicalinspect — logical decoding components inspection <a href="#PGLOGICALINSPECT" class="id_link">#</a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="sect2"><a href="pglogicalinspect.html#PGLOGICALINSPECT-FUNCS">F.28.1. Functions</a></span></dt><dt><span class="sect2"><a href="pglogicalinspect.html#PGLOGICALINSPECT-AUTHOR">F.28.2. Author</a></span></dt></dl></div><a id="id-1.11.7.38.2" class="indexterm"></a><p>
3 The <code class="filename">pg_logicalinspect</code> module provides SQL functions
4 that allow you to inspect the contents of logical decoding components. It
5 allows the inspection of serialized logical snapshots of a running
6 <span class="productname">PostgreSQL</span> database cluster, which is useful
7 for debugging or educational purposes.
9 By default, use of these functions is restricted to superusers and members of
10 the <code class="literal">pg_read_server_files</code> role. Access may be granted by
11 superusers to others using <code class="command">GRANT</code>.
12 </p><div class="sect2" id="PGLOGICALINSPECT-FUNCS"><div class="titlepage"><div><div><h3 class="title">F.28.1. Functions <a href="#PGLOGICALINSPECT-FUNCS" class="id_link">#</a></h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt id="PGLOGICALINSPECT-FUNCS-PG-GET-LOGICAL-SNAPSHOT-META"><span class="term">
13 <code class="function">pg_get_logical_snapshot_meta(filename text) returns record</code>
14 </span> <a href="#PGLOGICALINSPECT-FUNCS-PG-GET-LOGICAL-SNAPSHOT-META" class="id_link">#</a></dt><dd><p>
15 Gets logical snapshot metadata about a snapshot file that is located in
16 the server's <code class="filename">pg_logical/snapshots</code> directory.
17 The <em class="replaceable"><code>filename</code></em> argument represents the snapshot
20 </p><pre class="screen">
21 postgres=# SELECT * FROM pg_ls_logicalsnapdir();
22 -[ RECORD 1 ]+-----------------------
23 name | 0-40796E18.snap
25 modification | 2024-08-14 16:36:32+00
27 postgres=# SELECT * FROM pg_get_logical_snapshot_meta('0-40796E18.snap');
33 postgres=# SELECT ss.name, meta.* FROM pg_ls_logicalsnapdir() AS ss,
34 pg_get_logical_snapshot_meta(ss.name) AS meta;
35 -[ RECORD 1 ]-------------
36 name | 0-40796E18.snap
42 If <em class="replaceable"><code>filename</code></em> does not match a snapshot file, the
43 function raises an error.
44 </p></dd><dt id="PGLOGICALINSPECT-FUNCS-PG-GET-LOGICAL-SNAPSHOT-INFO"><span class="term">
45 <code class="function">pg_get_logical_snapshot_info(filename text) returns record</code>
46 </span> <a href="#PGLOGICALINSPECT-FUNCS-PG-GET-LOGICAL-SNAPSHOT-INFO" class="id_link">#</a></dt><dd><p>
47 Gets logical snapshot information about a snapshot file that is located in
48 the server's <code class="filename">pg_logical/snapshots</code> directory.
49 The <em class="replaceable"><code>filename</code></em> argument represents the snapshot
52 </p><pre class="screen">
53 postgres=# SELECT * FROM pg_ls_logicalsnapdir();
54 -[ RECORD 1 ]+-----------------------
55 name | 0-40796E18.snap
57 modification | 2024-08-14 16:36:32+00
59 postgres=# SELECT * FROM pg_get_logical_snapshot_info('0-40796E18.snap');
60 -[ RECORD 1 ]------------+-----------
64 start_decoding_at | 0/40796AF8
65 two_phase_at | 0/40796AF8
66 initial_xmin_horizon | 0
67 building_full_snapshot | f
69 last_serialized_snapshot | 0/0
74 catchange_xip | {751,752}
76 postgres=# SELECT ss.name, info.* FROM pg_ls_logicalsnapdir() AS ss,
77 pg_get_logical_snapshot_info(ss.name) AS info;
78 -[ RECORD 1 ]------------+----------------
79 name | 0-40796E18.snap
83 start_decoding_at | 0/40796AF8
84 two_phase_at | 0/40796AF8
85 initial_xmin_horizon | 0
86 building_full_snapshot | f
88 last_serialized_snapshot | 0/0
93 catchange_xip | {751,752}
96 If <em class="replaceable"><code>filename</code></em> does not match a snapshot file, the
97 function raises an error.
98 </p></dd></dl></div></div><div class="sect2" id="PGLOGICALINSPECT-AUTHOR"><div class="titlepage"><div><div><h3 class="title">F.28.2. Author <a href="#PGLOGICALINSPECT-AUTHOR" class="id_link">#</a></h3></div></div></div><p>
99 Bertrand Drouvot <code class="email"><<a class="email" href="mailto:bertranddrouvot.pg@gmail.com">bertranddrouvot.pg@gmail.com</a>></code>
100 </p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="pgfreespacemap.html" title="F.27. pg_freespacemap — examine the free space map">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="contrib.html" title="Appendix F. Additional Supplied Modules and Extensions">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="pgoverexplain.html" title="F.29. pg_overexplain — allow EXPLAIN to dump even more details">Next</a></td></tr><tr><td width="40%" align="left" valign="top">F.27. pg_freespacemap — examine the free space map </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 18.0 Documentation">Home</a></td><td width="40%" align="right" valign="top"> F.29. pg_overexplain — allow EXPLAIN to dump even more details</td></tr></table></div></body></html>