diff options
author | Peter Eisentraut <peter_e@gmx.net> | 2018-04-07 11:17:56 -0400 |
---|---|---|
committer | Peter Eisentraut <peter_e@gmx.net> | 2018-04-07 11:34:10 -0400 |
commit | 5dfd1e5a6696b271a2cdee54143fbc209c88c02f (patch) | |
tree | 9654f50fe72c84d737ad8edb4cdde339a4b36dcc /doc/src | |
parent | b508a56f2f3a2d850e75a14661943d6b4dde8274 (diff) |
Logical decoding of TRUNCATE
Add a new WAL record type for TRUNCATE, which is only used when
wal_level >= logical. (For physical replication, TRUNCATE is already
replicated via SMGR records.) Add new callback for logical decoding
output plugins to receive TRUNCATE actions.
Author: Simon Riggs <simon@2ndquadrant.com>
Author: Marco Nenciarini <marco.nenciarini@2ndquadrant.it>
Author: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Reviewed-by: Petr Jelinek <petr.jelinek@2ndquadrant.com>
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Alvaro Herrera <alvherre@alvh.no-ip.org>
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/logicaldecoding.sgml | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/doc/src/sgml/logicaldecoding.sgml b/doc/src/sgml/logicaldecoding.sgml index f6b14dccb09..b29cfe6fb40 100644 --- a/doc/src/sgml/logicaldecoding.sgml +++ b/doc/src/sgml/logicaldecoding.sgml @@ -383,6 +383,7 @@ typedef struct OutputPluginCallbacks LogicalDecodeStartupCB startup_cb; LogicalDecodeBeginCB begin_cb; LogicalDecodeChangeCB change_cb; + LogicalDecodeTruncateCB truncate_cb; LogicalDecodeCommitCB commit_cb; LogicalDecodeMessageCB message_cb; LogicalDecodeFilterByOriginCB filter_by_origin_cb; @@ -394,8 +395,10 @@ typedef void (*LogicalOutputPluginInit) (struct OutputPluginCallbacks *cb); The <function>begin_cb</function>, <function>change_cb</function> and <function>commit_cb</function> callbacks are required, while <function>startup_cb</function>, - <function>filter_by_origin_cb</function> + <function>filter_by_origin_cb</function>, <function>truncate_cb</function>, and <function>shutdown_cb</function> are optional. + If <function>truncate_cb</function> is not set but a + <command>TRUNCATE</command> is to be decoded, the action will be ignored. </para> </sect2> @@ -590,6 +593,28 @@ typedef void (*LogicalDecodeChangeCB) (struct LogicalDecodingContext *ctx, </note> </sect3> + <sect3 id="logicaldecoding-output-plugin-truncate"> + <title>Truncate Callback</title> + + <para> + The <function>truncate_cb</function> callback is called for a + <command>TRUNCATE</command> command. +<programlisting> +typedef void (*LogicalDecodeTruncateCB) (struct LogicalDecodingContext *ctx, + ReorderBufferTXN *txn, + int nrelations, + Relation relations[], + ReorderBufferChange *change); +</programlisting> + The parameters are analogous to the <function>change_cb</function> + callback. However, because <command>TRUNCATE</command> actions on + tables connected by foreign keys need to be executed together, this + callback receives an array of relations instead of just a single one. + See the description of the <xref linkend="sql-truncate"/> statement for + details. + </para> + </sect3> + <sect3 id="logicaldecoding-output-plugin-filter-origin"> <title>Origin Filter Callback</title> |