diff options
Diffstat (limited to '')
-rw-r--r-- | doc/src/sgml/html/test-decoding.html | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/doc/src/sgml/html/test-decoding.html b/doc/src/sgml/html/test-decoding.html new file mode 100644 index 0000000..3b77ac9 --- /dev/null +++ b/doc/src/sgml/html/test-decoding.html @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!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.42. test_decoding</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="tcn.html" title="F.41. tcn" /><link rel="next" href="tsm-system-rows.html" title="F.43. tsm_system_rows" /></head><body id="docContent" class="container-fluid col-10"><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">F.42. test_decoding</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="tcn.html" title="F.41. tcn">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="contrib.html" title="Appendix F. Additional Supplied Modules">Up</a></td><th width="60%" align="center">Appendix F. Additional Supplied Modules</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 14.5 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="tsm-system-rows.html" title="F.43. tsm_system_rows">Next</a></td></tr></table><hr></hr></div><div class="sect1" id="TEST-DECODING"><div class="titlepage"><div><div><h2 class="title" style="clear: both">F.42. test_decoding</h2></div></div></div><a id="id-1.11.7.51.2" class="indexterm"></a><p> + <code class="filename">test_decoding</code> is an example of a logical decoding + output plugin. It doesn't do anything especially useful, but can serve as + a starting point for developing your own output plugin. + </p><p> + <code class="filename">test_decoding</code> receives WAL through the logical decoding + mechanism and decodes it into text representations of the operations + performed. + </p><p> + Typical output from this plugin, used over the SQL logical decoding + interface, might be: + +</p><pre class="programlisting"> +postgres=# SELECT * FROM pg_logical_slot_get_changes('test_slot', NULL, NULL, 'include-xids', '0'); + lsn | xid | data +-----------+-----+-------------------------------------------------- + 0/16D30F8 | 691 | BEGIN + 0/16D32A0 | 691 | table public.data: INSERT: id[int4]:2 data[text]:'arg' + 0/16D32A0 | 691 | table public.data: INSERT: id[int4]:3 data[text]:'demo' + 0/16D32A0 | 691 | COMMIT + 0/16D32D8 | 692 | BEGIN + 0/16D3398 | 692 | table public.data: DELETE: id[int4]:2 + 0/16D3398 | 692 | table public.data: DELETE: id[int4]:3 + 0/16D3398 | 692 | COMMIT +(8 rows) +</pre><p> + </p><p> + We can also get the changes of the in-progress transaction, and the typical + output might be: + +</p><pre class="programlisting"> +postgres[33712]=#* SELECT * FROM pg_logical_slot_get_changes('test_slot', NULL, NULL, 'stream-changes', '1'); + lsn | xid | data +-----------+-----+-------------------------------------------------- + 0/16B21F8 | 503 | opening a streamed block for transaction TXN 503 + 0/16B21F8 | 503 | streaming change for TXN 503 + 0/16B2300 | 503 | streaming change for TXN 503 + 0/16B2408 | 503 | streaming change for TXN 503 + 0/16BEBA0 | 503 | closing a streamed block for transaction TXN 503 + 0/16B21F8 | 503 | opening a streamed block for transaction TXN 503 + 0/16BECA8 | 503 | streaming change for TXN 503 + 0/16BEDB0 | 503 | streaming change for TXN 503 + 0/16BEEB8 | 503 | streaming change for TXN 503 + 0/16BEBA0 | 503 | closing a streamed block for transaction TXN 503 +(10 rows) +</pre><p> + </p></div><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="navfooter"><hr></hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="tcn.html" title="F.41. tcn">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="contrib.html" title="Appendix F. Additional Supplied Modules">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="tsm-system-rows.html" title="F.43. tsm_system_rows">Next</a></td></tr><tr><td width="40%" align="left" valign="top">F.41. tcn </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 14.5 Documentation">Home</a></td><td width="40%" align="right" valign="top"> F.43. tsm_system_rows</td></tr></table></div></body></html>
\ No newline at end of file |