mirror of
https://github.com/postgres/postgres.git
synced 2025-07-31 22:04:40 +03:00
Introduce logical decoding.
This feature, building on previous commits, allows the write-ahead log stream to be decoded into a series of logical changes; that is, inserts, updates, and deletes and the transactions which contain them. It is capable of handling decoding even across changes to the schema of the effected tables. The output format is controlled by a so-called "output plugin"; an example is included. To make use of this in a real replication system, the output plugin will need to be modified to produce output in the format appropriate to that system, and to perform filtering. Currently, information can be extracted from the logical decoding system only via SQL; future commits will add the ability to stream changes via walsender. Andres Freund, with review and other contributions from many other people, including Álvaro Herrera, Abhijit Menon-Sen, Peter Gheogegan, Kevin Grittner, Robert Haas, Heikki Linnakangas, Fujii Masao, Abhijit Menon-Sen, Michael Paquier, Simon Riggs, Craig Ringer, and Steve Singer.
This commit is contained in:
@ -140,6 +140,7 @@ CREATE EXTENSION <replaceable>module_name</> FROM unpackaged;
|
||||
&sslinfo;
|
||||
&tablefunc;
|
||||
&tcn;
|
||||
&test-decoding;
|
||||
&test-parser;
|
||||
&test-shm-mq;
|
||||
&tsearch2;
|
||||
|
@ -143,6 +143,7 @@
|
||||
<!ENTITY sslinfo SYSTEM "sslinfo.sgml">
|
||||
<!ENTITY tablefunc SYSTEM "tablefunc.sgml">
|
||||
<!ENTITY tcn SYSTEM "tcn.sgml">
|
||||
<!ENTITY test-decoding SYSTEM "test-decoding.sgml">
|
||||
<!ENTITY test-parser SYSTEM "test-parser.sgml">
|
||||
<!ENTITY test-shm-mq SYSTEM "test-shm-mq.sgml">
|
||||
<!ENTITY tsearch2 SYSTEM "tsearch2.sgml">
|
||||
|
42
doc/src/sgml/test-decoding.sgml
Normal file
42
doc/src/sgml/test-decoding.sgml
Normal file
@ -0,0 +1,42 @@
|
||||
<!-- doc/src/sgml/test-decoding.sgml -->
|
||||
|
||||
<sect1 id="test-decoding" xreflabel="test_decoding">
|
||||
<title>test_decoding</title>
|
||||
|
||||
<indexterm zone="test-decoding">
|
||||
<primary>test_decoding</primary>
|
||||
</indexterm>
|
||||
|
||||
<para>
|
||||
<filename>test_decoding</> 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 decoder.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<filename>test_decoding</> receives WAL through the logical decoding
|
||||
mechanism and decodes it into text representations of the operations
|
||||
performed.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Typical output from this plugin, used over the SQL logical decoding
|
||||
interface, might be:
|
||||
|
||||
<programlisting>
|
||||
postgres=# SELECT * FROM pg_logical_slot_get_changes('test_slot', 'now', 'include-xids', '0');
|
||||
location | 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)
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
</sect1>
|
Reference in New Issue
Block a user