]> begriffs open source - ai-pg/blob - full-docs/html/protocol-logicalrep-message-formats.html
Include links to all subsection html pages, with shorter paths too
[ai-pg] / full-docs / html / protocol-logicalrep-message-formats.html
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>54.9. Logical Replication Message Formats</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="protocol-error-fields.html" title="54.8. Error and Notice Message Fields" /><link rel="next" href="protocol-changes.html" title="54.10. Summary of Changes since Protocol 2.0" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">54.9. Logical Replication Message Formats</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="protocol-error-fields.html" title="54.8. Error and Notice Message Fields">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="protocol.html" title="Chapter 54. Frontend/Backend Protocol">Up</a></td><th width="60%" align="center">Chapter 54. Frontend/Backend Protocol</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="protocol-changes.html" title="54.10. Summary of Changes since Protocol 2.0">Next</a></td></tr></table><hr /></div><div class="sect1" id="PROTOCOL-LOGICALREP-MESSAGE-FORMATS"><div class="titlepage"><div><div><h2 class="title" style="clear: both">54.9. Logical Replication Message Formats <a href="#PROTOCOL-LOGICALREP-MESSAGE-FORMATS" class="id_link">#</a></h2></div></div></div><p>
3    This section describes the detailed format of each logical replication
4    message.  These messages are either returned by the replication slot SQL
5    interface or are sent by a walsender.  In the case of a walsender, they are
6    encapsulated inside replication protocol WAL messages as described in
7    <a class="xref" href="protocol-replication.html" title="54.4. Streaming Replication Protocol">Section 54.4</a>, and generally obey the same message
8    flow as physical replication.
9   </p><div class="variablelist"><dl class="variablelist"><dt id="PROTOCOL-LOGICALREP-MESSAGE-FORMATS-BEGIN"><span class="term">Begin</span> <a href="#PROTOCOL-LOGICALREP-MESSAGE-FORMATS-BEGIN" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('B')</span></dt><dd><p>
10          Identifies the message as a begin message.
11         </p></dd><dt><span class="term">Int64 (XLogRecPtr)</span></dt><dd><p>
12          The final LSN of the transaction.
13         </p></dd><dt><span class="term">Int64 (TimestampTz)</span></dt><dd><p>
14          Commit timestamp of the transaction. The value is in number
15          of microseconds since PostgreSQL epoch (2000-01-01).
16         </p></dd><dt><span class="term">Int32 (TransactionId)</span></dt><dd><p>
17          Xid of the transaction.
18         </p></dd></dl></div></dd><dt id="PROTOCOL-LOGICALREP-MESSAGE-FORMATS-MESSAGE"><span class="term">Message</span> <a href="#PROTOCOL-LOGICALREP-MESSAGE-FORMATS-MESSAGE" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('M')</span></dt><dd><p>
19          Identifies the message as a logical decoding message.
20         </p></dd><dt><span class="term">Int32 (TransactionId)</span></dt><dd><p>
21          Xid of the transaction (only present for streamed transactions).
22          This field is available since protocol version 2.
23         </p></dd><dt><span class="term">Int8</span></dt><dd><p>
24          Flags; Either 0 for no flags or 1 if the logical decoding
25          message is transactional.
26         </p></dd><dt><span class="term">Int64 (XLogRecPtr)</span></dt><dd><p>
27          The LSN of the logical decoding message.
28         </p></dd><dt><span class="term">String</span></dt><dd><p>
29          The prefix of the logical decoding message.
30         </p></dd><dt><span class="term">Int32</span></dt><dd><p>
31          Length of the content.
32         </p></dd><dt><span class="term">Byte<em class="replaceable"><code>n</code></em></span></dt><dd><p>
33          The content of the logical decoding message.
34         </p></dd></dl></div></dd><dt id="PROTOCOL-LOGICALREP-MESSAGE-FORMATS-COMMIT"><span class="term">Commit</span> <a href="#PROTOCOL-LOGICALREP-MESSAGE-FORMATS-COMMIT" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('C')</span></dt><dd><p>
35          Identifies the message as a commit message.
36         </p></dd><dt><span class="term">Int8(0)</span></dt><dd><p>
37          Flags; currently unused.
38         </p></dd><dt><span class="term">Int64 (XLogRecPtr)</span></dt><dd><p>
39          The LSN of the commit.
40         </p></dd><dt><span class="term">Int64 (XLogRecPtr)</span></dt><dd><p>
41          The end LSN of the transaction.
42         </p></dd><dt><span class="term">Int64 (TimestampTz)</span></dt><dd><p>
43          Commit timestamp of the transaction. The value is in number
44          of microseconds since PostgreSQL epoch (2000-01-01).
45         </p></dd></dl></div></dd><dt id="PROTOCOL-LOGICALREP-MESSAGE-FORMATS-ORIGIN"><span class="term">Origin</span> <a href="#PROTOCOL-LOGICALREP-MESSAGE-FORMATS-ORIGIN" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('O')</span></dt><dd><p>
46          Identifies the message as an origin message.
47         </p></dd><dt><span class="term">Int64 (XLogRecPtr)</span></dt><dd><p>
48          The LSN of the commit on the origin server.
49         </p></dd><dt><span class="term">String</span></dt><dd><p>
50          Name of the origin.
51         </p></dd></dl></div><p>
52       Note that there can be multiple Origin messages inside a single transaction.
53      </p></dd><dt id="PROTOCOL-LOGICALREP-MESSAGE-FORMATS-RELATION"><span class="term">Relation</span> <a href="#PROTOCOL-LOGICALREP-MESSAGE-FORMATS-RELATION" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('R')</span></dt><dd><p>
54          Identifies the message as a relation message.
55         </p></dd><dt><span class="term">Int32 (TransactionId)</span></dt><dd><p>
56          Xid of the transaction (only present for streamed transactions).
57          This field is available since protocol version 2.
58         </p></dd><dt><span class="term">Int32 (Oid)</span></dt><dd><p>
59          OID of the relation.
60         </p></dd><dt><span class="term">String</span></dt><dd><p>
61          Namespace (empty string for <code class="literal">pg_catalog</code>).
62         </p></dd><dt><span class="term">String</span></dt><dd><p>
63          Relation name.
64         </p></dd><dt><span class="term">Int8</span></dt><dd><p>
65          Replica identity setting for the relation (same as
66          <code class="structfield">relreplident</code> in <code class="structname">pg_class</code>).
67         </p></dd><dt><span class="term">Int16</span></dt><dd><p>
68          Number of columns.
69         </p></dd></dl></div><p>
70       Next, the following message part appears for each column included in
71       the publication:
72      </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">Int8</span></dt><dd><p>
73          Flags for the column. Currently can be either 0 for no flags
74          or 1 which marks the column as part of the key.
75         </p></dd><dt><span class="term">String</span></dt><dd><p>
76          Name of the column.
77         </p></dd><dt><span class="term">Int32 (Oid)</span></dt><dd><p>
78          OID of the column's data type.
79         </p></dd><dt><span class="term">Int32</span></dt><dd><p>
80          Type modifier of the column (<code class="structfield">atttypmod</code>).
81         </p></dd></dl></div></dd><dt id="PROTOCOL-LOGICALREP-MESSAGE-FORMATS-TYPE"><span class="term">Type</span> <a href="#PROTOCOL-LOGICALREP-MESSAGE-FORMATS-TYPE" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('Y')</span></dt><dd><p>
82          Identifies the message as a type message.
83         </p></dd><dt><span class="term">Int32 (TransactionId)</span></dt><dd><p>
84          Xid of the transaction (only present for streamed transactions).
85          This field is available since protocol version 2.
86         </p></dd><dt><span class="term">Int32 (Oid)</span></dt><dd><p>
87          OID of the data type.
88         </p></dd><dt><span class="term">String</span></dt><dd><p>
89          Namespace (empty string for <code class="literal">pg_catalog</code>).
90         </p></dd><dt><span class="term">String</span></dt><dd><p>
91          Name of the data type.
92         </p></dd></dl></div></dd><dt id="PROTOCOL-LOGICALREP-MESSAGE-FORMATS-INSERT"><span class="term">Insert</span> <a href="#PROTOCOL-LOGICALREP-MESSAGE-FORMATS-INSERT" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('I')</span></dt><dd><p>
93          Identifies the message as an insert message.
94         </p></dd><dt><span class="term">Int32 (TransactionId)</span></dt><dd><p>
95          Xid of the transaction (only present for streamed transactions).
96          This field is available since protocol version 2.
97         </p></dd><dt><span class="term">Int32 (Oid)</span></dt><dd><p>
98          OID of the relation corresponding to the ID in the relation
99          message.
100         </p></dd><dt><span class="term">Byte1('N')</span></dt><dd><p>
101          Identifies the following TupleData message as a new tuple.
102         </p></dd><dt><span class="term">TupleData</span></dt><dd><p>
103          TupleData message part representing the contents of new tuple.
104         </p></dd></dl></div></dd><dt id="PROTOCOL-LOGICALREP-MESSAGE-FORMATS-UPDATE"><span class="term">Update</span> <a href="#PROTOCOL-LOGICALREP-MESSAGE-FORMATS-UPDATE" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('U')</span></dt><dd><p>
105          Identifies the message as an update message.
106         </p></dd><dt><span class="term">Int32 (TransactionId)</span></dt><dd><p>
107          Xid of the transaction (only present for streamed transactions).
108          This field is available since protocol version 2.
109         </p></dd><dt><span class="term">Int32 (Oid)</span></dt><dd><p>
110          OID of the relation corresponding to the ID in the relation
111          message.
112         </p></dd><dt><span class="term">Byte1('K')</span></dt><dd><p>
113          Identifies the following TupleData submessage as a key.
114          This field is optional and is only present if
115          the update changed data in any of the column(s) that are
116          part of the REPLICA IDENTITY index.
117         </p></dd><dt><span class="term">Byte1('O')</span></dt><dd><p>
118          Identifies the following TupleData submessage as an old tuple.
119          This field is optional and is only present if table in which
120          the update happened has REPLICA IDENTITY set to FULL.
121         </p></dd><dt><span class="term">TupleData</span></dt><dd><p>
122          TupleData message part representing the contents of the old tuple
123          or primary key. Only present if the previous 'O' or 'K' part
124          is present.
125         </p></dd><dt><span class="term">Byte1('N')</span></dt><dd><p>
126          Identifies the following TupleData message as a new tuple.
127         </p></dd><dt><span class="term">TupleData</span></dt><dd><p>
128          TupleData message part representing the contents of a new tuple.
129         </p></dd></dl></div><p>
130       The Update message may contain either a 'K' message part or an 'O' message part
131       or neither of them, but never both of them.
132      </p></dd><dt id="PROTOCOL-LOGICALREP-MESSAGE-FORMATS-DELETE"><span class="term">Delete</span> <a href="#PROTOCOL-LOGICALREP-MESSAGE-FORMATS-DELETE" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('D')</span></dt><dd><p>
133          Identifies the message as a delete message.
134         </p></dd><dt><span class="term">Int32 (TransactionId)</span></dt><dd><p>
135          Xid of the transaction (only present for streamed transactions).
136          This field is available since protocol version 2.
137         </p></dd><dt><span class="term">Int32 (Oid)</span></dt><dd><p>
138          OID of the relation corresponding to the ID in the relation
139          message.
140         </p></dd><dt><span class="term">Byte1('K')</span></dt><dd><p>
141          Identifies the following TupleData submessage as a key.
142          This field is present if the table in which the delete has
143          happened uses an index as REPLICA IDENTITY.
144         </p></dd><dt><span class="term">Byte1('O')</span></dt><dd><p>
145          Identifies the following TupleData message as an old tuple.
146          This field is present if the table in which the delete
147          happened has REPLICA IDENTITY set to FULL.
148         </p></dd><dt><span class="term">TupleData</span></dt><dd><p>
149          TupleData message part representing the contents of the old tuple
150          or primary key, depending on the previous field.
151         </p></dd></dl></div><p>
152       The Delete message may contain either a 'K' message part or an 'O' message part,
153       but never both of them.
154      </p></dd><dt id="PROTOCOL-LOGICALREP-MESSAGE-FORMATS-TRUNCATE"><span class="term">Truncate</span> <a href="#PROTOCOL-LOGICALREP-MESSAGE-FORMATS-TRUNCATE" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('T')</span></dt><dd><p>
155          Identifies the message as a truncate message.
156         </p></dd><dt><span class="term">Int32 (TransactionId)</span></dt><dd><p>
157          Xid of the transaction (only present for streamed transactions).
158          This field is available since protocol version 2.
159         </p></dd><dt><span class="term">Int32</span></dt><dd><p>
160          Number of relations
161         </p></dd><dt><span class="term">Int8</span></dt><dd><p>
162          Option bits for <code class="command">TRUNCATE</code>:
163          1 for <code class="literal">CASCADE</code>, 2 for <code class="literal">RESTART IDENTITY</code>
164         </p></dd><dt><span class="term">Int32 (Oid)</span></dt><dd><p>
165          OID of the relation corresponding to the ID in the relation
166          message.  This field is repeated for each relation.
167         </p></dd></dl></div></dd></dl></div><p>
168    The following messages (Stream Start, Stream Stop, Stream Commit, and
169    Stream Abort) are available since protocol version 2.
170   </p><div class="variablelist"><dl class="variablelist"><dt id="PROTOCOL-LOGICALREP-MESSAGE-FORMATS-STREAM-START"><span class="term">Stream Start</span> <a href="#PROTOCOL-LOGICALREP-MESSAGE-FORMATS-STREAM-START" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('S')</span></dt><dd><p>
171          Identifies the message as a stream start message.
172         </p></dd><dt><span class="term">Int32 (TransactionId)</span></dt><dd><p>
173          Xid of the transaction.
174         </p></dd><dt><span class="term">Int8</span></dt><dd><p>
175          A value of 1 indicates this is the first stream segment for
176          this XID, 0 for any other stream segment.
177         </p></dd></dl></div></dd><dt id="PROTOCOL-LOGICALREP-MESSAGE-FORMATS-STREAM-STOP"><span class="term">Stream Stop</span> <a href="#PROTOCOL-LOGICALREP-MESSAGE-FORMATS-STREAM-STOP" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('E')</span></dt><dd><p>
178          Identifies the message as a stream stop message.
179         </p></dd></dl></div></dd><dt id="PROTOCOL-LOGICALREP-MESSAGE-FORMATS-STREAM-COMMIT"><span class="term">Stream Commit</span> <a href="#PROTOCOL-LOGICALREP-MESSAGE-FORMATS-STREAM-COMMIT" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('c')</span></dt><dd><p>
180          Identifies the message as a stream commit message.
181         </p></dd><dt><span class="term">Int32 (TransactionId)</span></dt><dd><p>
182          Xid of the transaction.
183         </p></dd><dt><span class="term">Int8(0)</span></dt><dd><p>
184          Flags; currently unused.
185         </p></dd><dt><span class="term">Int64 (XLogRecPtr)</span></dt><dd><p>
186          The LSN of the commit.
187         </p></dd><dt><span class="term">Int64 (XLogRecPtr)</span></dt><dd><p>
188          The end LSN of the transaction.
189         </p></dd><dt><span class="term">Int64 (TimestampTz)</span></dt><dd><p>
190          Commit timestamp of the transaction. The value is in number
191          of microseconds since PostgreSQL epoch (2000-01-01).
192         </p></dd></dl></div></dd><dt id="PROTOCOL-LOGICALREP-MESSAGE-FORMATS-STREAM-ABORT"><span class="term">Stream Abort</span> <a href="#PROTOCOL-LOGICALREP-MESSAGE-FORMATS-STREAM-ABORT" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('A')</span></dt><dd><p>
193          Identifies the message as a stream abort message.
194         </p></dd><dt><span class="term">Int32 (TransactionId)</span></dt><dd><p>
195          Xid of the transaction.
196         </p></dd><dt><span class="term">Int32 (TransactionId)</span></dt><dd><p>
197          Xid of the subtransaction (will be same as xid of the transaction for top-level
198          transactions).
199         </p></dd><dt><span class="term">Int64 (XLogRecPtr)</span></dt><dd><p>
200          The LSN of the abort operation, present only when streaming is set to parallel.
201          This field is available since protocol version 4.
202         </p></dd><dt><span class="term">Int64 (TimestampTz)</span></dt><dd><p>
203          Abort timestamp of the transaction, present only when streaming is set to
204          parallel. The value is in number of microseconds since PostgreSQL epoch (2000-01-01).
205          This field is available since protocol version 4.
206         </p></dd></dl></div></dd></dl></div><p>
207    The following messages (Begin Prepare, Prepare, Commit Prepared, Rollback Prepared, Stream Prepare)
208    are available since protocol version 3.
209   </p><div class="variablelist"><dl class="variablelist"><dt id="PROTOCOL-LOGICALREP-MESSAGE-FORMATS-BEGIN-PREPARE"><span class="term">Begin Prepare</span> <a href="#PROTOCOL-LOGICALREP-MESSAGE-FORMATS-BEGIN-PREPARE" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('b')</span></dt><dd><p>
210          Identifies the message as the beginning of a prepared transaction message.
211         </p></dd><dt><span class="term">Int64 (XLogRecPtr)</span></dt><dd><p>
212          The LSN of the prepare.
213         </p></dd><dt><span class="term">Int64 (XLogRecPtr)</span></dt><dd><p>
214          The end LSN of the prepared transaction.
215         </p></dd><dt><span class="term">Int64 (TimestampTz)</span></dt><dd><p>
216          Prepare timestamp of the transaction. The value is in number
217          of microseconds since PostgreSQL epoch (2000-01-01).
218         </p></dd><dt><span class="term">Int32 (TransactionId)</span></dt><dd><p>
219          Xid of the transaction.
220         </p></dd><dt><span class="term">String</span></dt><dd><p>
221          The user defined GID of the prepared transaction.
222         </p></dd></dl></div></dd><dt id="PROTOCOL-LOGICALREP-MESSAGE-FORMATS-PREPARE"><span class="term">Prepare</span> <a href="#PROTOCOL-LOGICALREP-MESSAGE-FORMATS-PREPARE" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('P')</span></dt><dd><p>
223          Identifies the message as a prepared transaction message.
224         </p></dd><dt><span class="term">Int8(0)</span></dt><dd><p>
225          Flags; currently unused.
226         </p></dd><dt><span class="term">Int64 (XLogRecPtr)</span></dt><dd><p>
227          The LSN of the prepare.
228         </p></dd><dt><span class="term">Int64 (XLogRecPtr)</span></dt><dd><p>
229          The end LSN of the prepared transaction.
230         </p></dd><dt><span class="term">Int64 (TimestampTz)</span></dt><dd><p>
231          Prepare timestamp of the transaction. The value is in number
232          of microseconds since PostgreSQL epoch (2000-01-01).
233         </p></dd><dt><span class="term">Int32 (TransactionId)</span></dt><dd><p>
234          Xid of the transaction.
235         </p></dd><dt><span class="term">String</span></dt><dd><p>
236          The user defined GID of the prepared transaction.
237         </p></dd></dl></div></dd><dt id="PROTOCOL-LOGICALREP-MESSAGE-FORMATS-COMMIT-PREPARED"><span class="term">Commit Prepared</span> <a href="#PROTOCOL-LOGICALREP-MESSAGE-FORMATS-COMMIT-PREPARED" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('K')</span></dt><dd><p>
238          Identifies the message as the commit of a prepared transaction message.
239         </p></dd><dt><span class="term">Int8(0)</span></dt><dd><p>
240          Flags; currently unused.
241         </p></dd><dt><span class="term">Int64 (XLogRecPtr)</span></dt><dd><p>
242          The LSN of the commit of the prepared transaction.
243         </p></dd><dt><span class="term">Int64 (XLogRecPtr)</span></dt><dd><p>
244          The end LSN of the commit of the prepared transaction.
245         </p></dd><dt><span class="term">Int64 (TimestampTz)</span></dt><dd><p>
246          Commit timestamp of the transaction. The value is in number
247          of microseconds since PostgreSQL epoch (2000-01-01).
248         </p></dd><dt><span class="term">Int32 (TransactionId)</span></dt><dd><p>
249          Xid of the transaction.
250         </p></dd><dt><span class="term">String</span></dt><dd><p>
251          The user defined GID of the prepared transaction.
252         </p></dd></dl></div></dd><dt id="PROTOCOL-LOGICALREP-MESSAGE-FORMATS-ROLLBACK-PREPARED"><span class="term">Rollback Prepared</span> <a href="#PROTOCOL-LOGICALREP-MESSAGE-FORMATS-ROLLBACK-PREPARED" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('r')</span></dt><dd><p>
253          Identifies the message as the rollback of a prepared transaction message.
254         </p></dd><dt><span class="term">Int8(0)</span></dt><dd><p>
255          Flags; currently unused.
256         </p></dd><dt><span class="term">Int64 (XLogRecPtr)</span></dt><dd><p>
257          The end LSN of the prepared transaction.
258         </p></dd><dt><span class="term">Int64 (XLogRecPtr)</span></dt><dd><p>
259          The end LSN of the rollback of the prepared transaction.
260         </p></dd><dt><span class="term">Int64 (TimestampTz)</span></dt><dd><p>
261          Prepare timestamp of the transaction. The value is in number
262          of microseconds since PostgreSQL epoch (2000-01-01).
263         </p></dd><dt><span class="term">Int64 (TimestampTz)</span></dt><dd><p>
264          Rollback timestamp of the transaction. The value is in number
265          of microseconds since PostgreSQL epoch (2000-01-01).
266         </p></dd><dt><span class="term">Int32 (TransactionId)</span></dt><dd><p>
267          Xid of the transaction.
268         </p></dd><dt><span class="term">String</span></dt><dd><p>
269          The user defined GID of the prepared transaction.
270         </p></dd></dl></div></dd><dt id="PROTOCOL-LOGICALREP-MESSAGE-FORMATS-STREAM-PREPARE"><span class="term">Stream Prepare</span> <a href="#PROTOCOL-LOGICALREP-MESSAGE-FORMATS-STREAM-PREPARE" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('p')</span></dt><dd><p>
271          Identifies the message as a stream prepared transaction message.
272         </p></dd><dt><span class="term">Int8(0)</span></dt><dd><p>
273          Flags; currently unused.
274         </p></dd><dt><span class="term">Int64 (XLogRecPtr)</span></dt><dd><p>
275          The LSN of the prepare.
276         </p></dd><dt><span class="term">Int64 (XLogRecPtr)</span></dt><dd><p>
277          The end LSN of the prepared transaction.
278         </p></dd><dt><span class="term">Int64 (TimestampTz)</span></dt><dd><p>
279          Prepare timestamp of the transaction. The value is in number
280          of microseconds since PostgreSQL epoch (2000-01-01).
281         </p></dd><dt><span class="term">Int32 (TransactionId)</span></dt><dd><p>
282          Xid of the transaction.
283         </p></dd><dt><span class="term">String</span></dt><dd><p>
284          The user defined GID of the prepared transaction.
285         </p></dd></dl></div></dd></dl></div><p>
286    The following message parts are shared by the above messages.
287   </p><div class="variablelist"><dl class="variablelist"><dt id="PROTOCOL-LOGICALREP-MESSAGE-FORMATS-TUPLEDATA"><span class="term">TupleData</span> <a href="#PROTOCOL-LOGICALREP-MESSAGE-FORMATS-TUPLEDATA" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Int16</span></dt><dd><p>
288          Number of columns.
289         </p></dd></dl></div><p>
290       Next, one of the following submessages appears for each published column:
291
292       </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('n')</span></dt><dd><p>
293           Identifies the data as NULL value.
294          </p></dd></dl></div><p>
295       Or
296       </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('u')</span></dt><dd><p>
297           Identifies unchanged TOASTed value (the actual value is not
298           sent).
299          </p></dd></dl></div><p>
300       Or
301       </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('t')</span></dt><dd><p>
302           Identifies the data as text formatted value.
303          </p></dd></dl></div><p>
304       Or
305       </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('b')</span></dt><dd><p>
306           Identifies the data as binary formatted value.
307          </p></dd><dt><span class="term">Int32</span></dt><dd><p>
308           Length of the column value.
309          </p></dd><dt><span class="term">Byte<em class="replaceable"><code>n</code></em></span></dt><dd><p>
310           The value of the column, either in binary or in text format.
311           (As specified in the preceding format byte).
312           <em class="replaceable"><code>n</code></em> is the above length.
313          </p></dd></dl></div><p>
314      </p></dd></dl></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="protocol-error-fields.html" title="54.8. Error and Notice Message Fields">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="protocol.html" title="Chapter 54. Frontend/Backend Protocol">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="protocol-changes.html" title="54.10. Summary of Changes since Protocol 2.0">Next</a></td></tr><tr><td width="40%" align="left" valign="top">54.8. Error and Notice Message Fields </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"> 54.10. Summary of Changes since Protocol 2.0</td></tr></table></div></body></html>