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.7. 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-message-types.html" title="54.6. Message Data Types" /><link rel="next" href="protocol-error-fields.html" title="54.8. Error and Notice Message Fields" /></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.7. Message Formats</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="protocol-message-types.html" title="54.6. Message Data Types">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-error-fields.html" title="54.8. Error and Notice Message Fields">Next</a></td></tr></table><hr /></div><div class="sect1" id="PROTOCOL-MESSAGE-FORMATS"><div class="titlepage"><div><div><h2 class="title" style="clear: both">54.7. Message Formats <a href="#PROTOCOL-MESSAGE-FORMATS" class="id_link">#</a></h2></div></div></div><p>
3 This section describes the detailed format of each message. Each is marked to
4 indicate that it can be sent by a frontend (F), a backend (B), or both
6 Notice that although each message includes a byte count at the beginning,
7 most messages are defined so that the message end can be found without
8 reference to the byte count. This is for historical reasons, as the
9 original, now-obsolete protocol version 2 did not have an explicit length
10 field. It also aids validity checking though.
11 </p><div class="variablelist"><dl class="variablelist"><dt id="PROTOCOL-MESSAGE-FORMATS-AUTHENTICATIONOK"><span class="term">AuthenticationOk (B)</span> <a href="#PROTOCOL-MESSAGE-FORMATS-AUTHENTICATIONOK" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('R')</span></dt><dd><p>
12 Identifies the message as an authentication request.
13 </p></dd><dt><span class="term">Int32(8)</span></dt><dd><p>
14 Length of message contents in bytes, including self.
15 </p></dd><dt><span class="term">Int32(0)</span></dt><dd><p>
16 Specifies that the authentication was successful.
17 </p></dd></dl></div></dd><dt id="PROTOCOL-MESSAGE-FORMATS-AUTHENTICATIONKERBEROSV5"><span class="term">AuthenticationKerberosV5 (B)</span> <a href="#PROTOCOL-MESSAGE-FORMATS-AUTHENTICATIONKERBEROSV5" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('R')</span></dt><dd><p>
18 Identifies the message as an authentication request.
19 </p></dd><dt><span class="term">Int32(8)</span></dt><dd><p>
20 Length of message contents in bytes, including self.
21 </p></dd><dt><span class="term">Int32(2)</span></dt><dd><p>
22 Specifies that Kerberos V5 authentication is required.
23 </p></dd></dl></div></dd><dt id="PROTOCOL-MESSAGE-FORMATS-AUTHENTICATIONCLEARTEXTPASSWORD"><span class="term">AuthenticationCleartextPassword (B)</span> <a href="#PROTOCOL-MESSAGE-FORMATS-AUTHENTICATIONCLEARTEXTPASSWORD" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('R')</span></dt><dd><p>
24 Identifies the message as an authentication request.
25 </p></dd><dt><span class="term">Int32(8)</span></dt><dd><p>
26 Length of message contents in bytes, including self.
27 </p></dd><dt><span class="term">Int32(3)</span></dt><dd><p>
28 Specifies that a clear-text password is required.
29 </p></dd></dl></div></dd><dt id="PROTOCOL-MESSAGE-FORMATS-AUTHENTICATIONMD5PASSWORD"><span class="term">AuthenticationMD5Password (B)</span> <a href="#PROTOCOL-MESSAGE-FORMATS-AUTHENTICATIONMD5PASSWORD" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('R')</span></dt><dd><p>
30 Identifies the message as an authentication request.
31 </p></dd><dt><span class="term">Int32(12)</span></dt><dd><p>
32 Length of message contents in bytes, including self.
33 </p></dd><dt><span class="term">Int32(5)</span></dt><dd><p>
34 Specifies that an MD5-encrypted password is required.
35 </p></dd><dt><span class="term">Byte4</span></dt><dd><p>
36 The salt to use when encrypting the password.
37 </p></dd></dl></div></dd><dt id="PROTOCOL-MESSAGE-FORMATS-AUTHENTICATIONGSS"><span class="term">AuthenticationGSS (B)</span> <a href="#PROTOCOL-MESSAGE-FORMATS-AUTHENTICATIONGSS" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('R')</span></dt><dd><p>
38 Identifies the message as an authentication request.
39 </p></dd><dt><span class="term">Int32(8)</span></dt><dd><p>
40 Length of message contents in bytes, including self.
41 </p></dd><dt><span class="term">Int32(7)</span></dt><dd><p>
42 Specifies that GSSAPI authentication is required.
43 </p></dd></dl></div></dd><dt id="PROTOCOL-MESSAGE-FORMATS-AUTHENTICATIONGSSCONTINUE"><span class="term">AuthenticationGSSContinue (B)</span> <a href="#PROTOCOL-MESSAGE-FORMATS-AUTHENTICATIONGSSCONTINUE" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('R')</span></dt><dd><p>
44 Identifies the message as an authentication request.
45 </p></dd><dt><span class="term">Int32</span></dt><dd><p>
46 Length of message contents in bytes, including self.
47 </p></dd><dt><span class="term">Int32(8)</span></dt><dd><p>
48 Specifies that this message contains GSSAPI or SSPI data.
49 </p></dd><dt><span class="term">Byte<em class="replaceable"><code>n</code></em></span></dt><dd><p>
50 GSSAPI or SSPI authentication data.
51 </p></dd></dl></div></dd><dt id="PROTOCOL-MESSAGE-FORMATS-AUTHENTICATIONSSPI"><span class="term">AuthenticationSSPI (B)</span> <a href="#PROTOCOL-MESSAGE-FORMATS-AUTHENTICATIONSSPI" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('R')</span></dt><dd><p>
52 Identifies the message as an authentication request.
53 </p></dd><dt><span class="term">Int32(8)</span></dt><dd><p>
54 Length of message contents in bytes, including self.
55 </p></dd><dt><span class="term">Int32(9)</span></dt><dd><p>
56 Specifies that SSPI authentication is required.
57 </p></dd></dl></div></dd><dt id="PROTOCOL-MESSAGE-FORMATS-AUTHENTICATIONSASL"><span class="term">AuthenticationSASL (B)</span> <a href="#PROTOCOL-MESSAGE-FORMATS-AUTHENTICATIONSASL" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('R')</span></dt><dd><p>
58 Identifies the message as an authentication request.
59 </p></dd><dt><span class="term">Int32</span></dt><dd><p>
60 Length of message contents in bytes, including self.
61 </p></dd><dt><span class="term">Int32(10)</span></dt><dd><p>
62 Specifies that SASL authentication is required.
63 </p></dd></dl></div><p>
64 The message body is a list of SASL authentication mechanisms, in the
65 server's order of preference. A zero byte is required as terminator after
66 the last authentication mechanism name. For each mechanism, there is the
69 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">String</span></dt><dd><p>
70 Name of a SASL authentication mechanism.
71 </p></dd></dl></div><p>
72 </p></dd><dt id="PROTOCOL-MESSAGE-FORMATS-AUTHENTICATIONSASLCONTINUE"><span class="term">AuthenticationSASLContinue (B)</span> <a href="#PROTOCOL-MESSAGE-FORMATS-AUTHENTICATIONSASLCONTINUE" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('R')</span></dt><dd><p>
73 Identifies the message as an authentication request.
74 </p></dd><dt><span class="term">Int32</span></dt><dd><p>
75 Length of message contents in bytes, including self.
76 </p></dd><dt><span class="term">Int32(11)</span></dt><dd><p>
77 Specifies that this message contains a SASL challenge.
78 </p></dd><dt><span class="term">Byte<em class="replaceable"><code>n</code></em></span></dt><dd><p>
79 SASL data, specific to the SASL mechanism being used.
80 </p></dd></dl></div></dd><dt id="PROTOCOL-MESSAGE-FORMATS-AUTHENTICATIONSASLFINAL"><span class="term">AuthenticationSASLFinal (B)</span> <a href="#PROTOCOL-MESSAGE-FORMATS-AUTHENTICATIONSASLFINAL" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('R')</span></dt><dd><p>
81 Identifies the message as an authentication request.
82 </p></dd><dt><span class="term">Int32</span></dt><dd><p>
83 Length of message contents in bytes, including self.
84 </p></dd><dt><span class="term">Int32(12)</span></dt><dd><p>
85 Specifies that SASL authentication has completed.
86 </p></dd><dt><span class="term">Byte<em class="replaceable"><code>n</code></em></span></dt><dd><p>
87 SASL outcome "additional data", specific to the SASL mechanism
89 </p></dd></dl></div></dd><dt id="PROTOCOL-MESSAGE-FORMATS-BACKENDKEYDATA"><span class="term">BackendKeyData (B)</span> <a href="#PROTOCOL-MESSAGE-FORMATS-BACKENDKEYDATA" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('K')</span></dt><dd><p>
90 Identifies the message as cancellation key data.
91 The frontend must save these values if it wishes to be
92 able to issue CancelRequest messages later.
93 </p></dd><dt><span class="term">Int32</span></dt><dd><p>
94 Length of message contents in bytes, including self.
95 </p></dd><dt><span class="term">Int32</span></dt><dd><p>
96 The process ID of this backend.
97 </p></dd><dt><span class="term">Byte<em class="replaceable"><code>n</code></em></span></dt><dd><p>
98 The secret key of this backend. This field extends to the end of the
99 message, indicated by the length field.
101 The minimum and maximum key length are 4 and 256 bytes, respectively. The
102 <span class="productname">PostgreSQL</span> server only sends keys up to
103 32 bytes, but the larger maximum size allows for future server
104 versions, as well as connection poolers and other middleware, to use
105 longer keys. One possible use case is augmenting the server's key
106 with extra information. Middleware is therefore also encouraged to
107 not use up all of the bytes, in case multiple middleware
108 applications are layered on top of each other, each of which may
109 wrap the key with extra data.
110 </p></dd></dl></div><p>
111 Before protocol version 3.2, the secret key was always 4 bytes long.
112 </p></dd><dt id="PROTOCOL-MESSAGE-FORMATS-BIND"><span class="term">Bind (F)</span> <a href="#PROTOCOL-MESSAGE-FORMATS-BIND" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('B')</span></dt><dd><p>
113 Identifies the message as a Bind command.
114 </p></dd><dt><span class="term">Int32</span></dt><dd><p>
115 Length of message contents in bytes, including self.
116 </p></dd><dt><span class="term">String</span></dt><dd><p>
117 The name of the destination portal
118 (an empty string selects the unnamed portal).
119 </p></dd><dt><span class="term">String</span></dt><dd><p>
120 The name of the source prepared statement
121 (an empty string selects the unnamed prepared statement).
122 </p></dd><dt><span class="term">Int16</span></dt><dd><p>
123 The number of parameter format codes that follow
124 (denoted <em class="replaceable"><code>C</code></em> below).
125 This can be zero to indicate that there are no parameters
126 or that the parameters all use the default format (text);
127 or one, in which case the specified format code is applied
128 to all parameters; or it can equal the actual number of
130 </p></dd><dt><span class="term">Int16[<em class="replaceable"><code>C</code></em>]</span></dt><dd><p>
131 The parameter format codes. Each must presently be
132 zero (text) or one (binary).
133 </p></dd><dt><span class="term">Int16</span></dt><dd><p>
134 The number of parameter values that follow (possibly zero).
135 This must match the number of parameters needed by the query.
136 </p></dd></dl></div><p>
137 Next, the following pair of fields appear for each parameter:
138 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">Int32</span></dt><dd><p>
139 The length of the parameter value, in bytes (this count
140 does not include itself). Can be zero.
141 As a special case, -1 indicates a NULL parameter value.
142 No value bytes follow in the NULL case.
143 </p></dd><dt><span class="term">Byte<em class="replaceable"><code>n</code></em></span></dt><dd><p>
144 The value of the parameter, in the format indicated by the
145 associated format code.
146 <em class="replaceable"><code>n</code></em> is the above length.
147 </p></dd></dl></div><p>
148 After the last parameter, the following fields appear:
149 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">Int16</span></dt><dd><p>
150 The number of result-column format codes that follow
151 (denoted <em class="replaceable"><code>R</code></em> below).
152 This can be zero to indicate that there are no result columns
153 or that the result columns should all use the default format
155 or one, in which case the specified format code is applied
156 to all result columns (if any); or it can equal the actual
157 number of result columns of the query.
158 </p></dd><dt><span class="term">Int16[<em class="replaceable"><code>R</code></em>]</span></dt><dd><p>
159 The result-column format codes. Each must presently be
160 zero (text) or one (binary).
161 </p></dd></dl></div></dd><dt id="PROTOCOL-MESSAGE-FORMATS-BINDCOMPLETE"><span class="term">BindComplete (B)</span> <a href="#PROTOCOL-MESSAGE-FORMATS-BINDCOMPLETE" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('2')</span></dt><dd><p>
162 Identifies the message as a Bind-complete indicator.
163 </p></dd><dt><span class="term">Int32(4)</span></dt><dd><p>
164 Length of message contents in bytes, including self.
165 </p></dd></dl></div></dd><dt id="PROTOCOL-MESSAGE-FORMATS-CANCELREQUEST"><span class="term">CancelRequest (F)</span> <a href="#PROTOCOL-MESSAGE-FORMATS-CANCELREQUEST" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Int32(16)</span></dt><dd><p>
166 Length of message contents in bytes, including self.
167 </p></dd><dt><span class="term">Int32(80877102)</span></dt><dd><p>
168 The cancel request code. The value is chosen to contain
169 <code class="literal">1234</code> in the most significant 16 bits, and <code class="literal">5678</code> in the
170 least significant 16 bits. (To avoid confusion, this code
171 must not be the same as any protocol version number.)
172 </p></dd><dt><span class="term">Int32</span></dt><dd><p>
173 The process ID of the target backend.
174 </p></dd><dt><span class="term">Byte<em class="replaceable"><code>n</code></em></span></dt><dd><p>
175 The secret key for the target backend. This field extends to the end of the
176 message, indicated by the length field. The maximum key length is 256 bytes.
177 </p></dd></dl></div><p>
178 Before protocol version 3.2, the secret key was always 4 bytes long.
179 </p></dd><dt id="PROTOCOL-MESSAGE-FORMATS-CLOSE"><span class="term">Close (F)</span> <a href="#PROTOCOL-MESSAGE-FORMATS-CLOSE" 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 Close command.
181 </p></dd><dt><span class="term">Int32</span></dt><dd><p>
182 Length of message contents in bytes, including self.
183 </p></dd><dt><span class="term">Byte1</span></dt><dd><p>
184 '<code class="literal">S</code>' to close a prepared statement; or
185 '<code class="literal">P</code>' to close a portal.
186 </p></dd><dt><span class="term">String</span></dt><dd><p>
187 The name of the prepared statement or portal to close
188 (an empty string selects the unnamed prepared statement
190 </p></dd></dl></div></dd><dt id="PROTOCOL-MESSAGE-FORMATS-CLOSECOMPLETE"><span class="term">CloseComplete (B)</span> <a href="#PROTOCOL-MESSAGE-FORMATS-CLOSECOMPLETE" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('3')</span></dt><dd><p>
191 Identifies the message as a Close-complete indicator.
192 </p></dd><dt><span class="term">Int32(4)</span></dt><dd><p>
193 Length of message contents in bytes, including self.
194 </p></dd></dl></div></dd><dt id="PROTOCOL-MESSAGE-FORMATS-COMMANDCOMPLETE"><span class="term">CommandComplete (B)</span> <a href="#PROTOCOL-MESSAGE-FORMATS-COMMANDCOMPLETE" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('C')</span></dt><dd><p>
195 Identifies the message as a command-completed response.
196 </p></dd><dt><span class="term">Int32</span></dt><dd><p>
197 Length of message contents in bytes, including self.
198 </p></dd><dt><span class="term">String</span></dt><dd><p>
199 The command tag. This is usually a single
200 word that identifies which SQL command was completed.
202 For an <code class="command">INSERT</code> command, the tag is
203 <code class="literal">INSERT <em class="replaceable"><code>oid</code></em>
204 <em class="replaceable"><code>rows</code></em></code>, where
205 <em class="replaceable"><code>rows</code></em> is the number of rows
206 inserted. <em class="replaceable"><code>oid</code></em> used to be the object ID
207 of the inserted row if <em class="replaceable"><code>rows</code></em> was 1
208 and the target table had OIDs, but OIDs system columns are
209 not supported anymore; therefore <em class="replaceable"><code>oid</code></em>
212 For a <code class="command">DELETE</code> command, the tag is
213 <code class="literal">DELETE <em class="replaceable"><code>rows</code></em></code> where
214 <em class="replaceable"><code>rows</code></em> is the number of rows deleted.
216 For an <code class="command">UPDATE</code> command, the tag is
217 <code class="literal">UPDATE <em class="replaceable"><code>rows</code></em></code> where
218 <em class="replaceable"><code>rows</code></em> is the number of rows updated.
220 For a <code class="command">MERGE</code> command, the tag is
221 <code class="literal">MERGE <em class="replaceable"><code>rows</code></em></code> where
222 <em class="replaceable"><code>rows</code></em> is the number of rows inserted,
225 For a <code class="command">SELECT</code> or <code class="command">CREATE TABLE AS</code>
226 command, the tag is <code class="literal">SELECT <em class="replaceable"><code>rows</code></em></code>
227 where <em class="replaceable"><code>rows</code></em> is the number of rows retrieved.
229 For a <code class="command">MOVE</code> command, the tag is
230 <code class="literal">MOVE <em class="replaceable"><code>rows</code></em></code> where
231 <em class="replaceable"><code>rows</code></em> is the number of rows the
232 cursor's position has been changed by.
234 For a <code class="command">FETCH</code> command, the tag is
235 <code class="literal">FETCH <em class="replaceable"><code>rows</code></em></code> where
236 <em class="replaceable"><code>rows</code></em> is the number of rows that
237 have been retrieved from the cursor.
239 For a <code class="command">COPY</code> command, the tag is
240 <code class="literal">COPY <em class="replaceable"><code>rows</code></em></code> where
241 <em class="replaceable"><code>rows</code></em> is the number of rows copied.
242 (Note: the row count appears only in
243 <span class="productname">PostgreSQL</span> 8.2 and later.)
244 </p></dd></dl></div></dd><dt id="PROTOCOL-MESSAGE-FORMATS-COPYDATA"><span class="term">CopyData (F & B)</span> <a href="#PROTOCOL-MESSAGE-FORMATS-COPYDATA" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('d')</span></dt><dd><p>
245 Identifies the message as <code class="command">COPY</code> data.
246 </p></dd><dt><span class="term">Int32</span></dt><dd><p>
247 Length of message contents in bytes, including self.
248 </p></dd><dt><span class="term">Byte<em class="replaceable"><code>n</code></em></span></dt><dd><p>
249 Data that forms part of a <code class="command">COPY</code> data stream. Messages sent
250 from the backend will always correspond to single data rows,
251 but messages sent by frontends might divide the data stream
253 </p></dd></dl></div></dd><dt id="PROTOCOL-MESSAGE-FORMATS-COPYDONE"><span class="term">CopyDone (F & B)</span> <a href="#PROTOCOL-MESSAGE-FORMATS-COPYDONE" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('c')</span></dt><dd><p>
254 Identifies the message as a <code class="command">COPY</code>-complete indicator.
255 </p></dd><dt><span class="term">Int32(4)</span></dt><dd><p>
256 Length of message contents in bytes, including self.
257 </p></dd></dl></div></dd><dt id="PROTOCOL-MESSAGE-FORMATS-COPYFAIL"><span class="term">CopyFail (F)</span> <a href="#PROTOCOL-MESSAGE-FORMATS-COPYFAIL" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('f')</span></dt><dd><p>
258 Identifies the message as a <code class="command">COPY</code>-failure indicator.
259 </p></dd><dt><span class="term">Int32</span></dt><dd><p>
260 Length of message contents in bytes, including self.
261 </p></dd><dt><span class="term">String</span></dt><dd><p>
262 An error message to report as the cause of failure.
263 </p></dd></dl></div></dd><dt id="PROTOCOL-MESSAGE-FORMATS-COPYINRESPONSE"><span class="term">CopyInResponse (B)</span> <a href="#PROTOCOL-MESSAGE-FORMATS-COPYINRESPONSE" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('G')</span></dt><dd><p>
264 Identifies the message as a Start Copy In response.
265 The frontend must now send copy-in data (if not
266 prepared to do so, send a CopyFail message).
267 </p></dd><dt><span class="term">Int32</span></dt><dd><p>
268 Length of message contents in bytes, including self.
269 </p></dd><dt><span class="term">Int8</span></dt><dd><p>
270 0 indicates the overall <code class="command">COPY</code> format is textual (rows
271 separated by newlines, columns separated by separator
273 1 indicates the overall copy format is binary (similar
275 See <a class="xref" href="sql-copy.html" title="COPY"><span class="refentrytitle">COPY</span></a>
276 for more information.
277 </p></dd><dt><span class="term">Int16</span></dt><dd><p>
278 The number of columns in the data to be copied
279 (denoted <em class="replaceable"><code>N</code></em> below).
280 </p></dd><dt><span class="term">Int16[<em class="replaceable"><code>N</code></em>]</span></dt><dd><p>
281 The format codes to be used for each column.
282 Each must presently be zero (text) or one (binary).
283 All must be zero if the overall copy format is textual.
284 </p></dd></dl></div></dd><dt id="PROTOCOL-MESSAGE-FORMATS-COPYOUTRESPONSE"><span class="term">CopyOutResponse (B)</span> <a href="#PROTOCOL-MESSAGE-FORMATS-COPYOUTRESPONSE" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('H')</span></dt><dd><p>
285 Identifies the message as a Start Copy Out response.
286 This message will be followed by copy-out data.
287 </p></dd><dt><span class="term">Int32</span></dt><dd><p>
288 Length of message contents in bytes, including self.
289 </p></dd><dt><span class="term">Int8</span></dt><dd><p>
290 0 indicates the overall <code class="command">COPY</code> format
291 is textual (rows separated by newlines, columns
292 separated by separator characters, etc.). 1 indicates
293 the overall copy format is binary (similar to DataRow
294 format). See <a class="xref" href="sql-copy.html" title="COPY"><span class="refentrytitle">COPY</span></a> for more information.
295 </p></dd><dt><span class="term">Int16</span></dt><dd><p>
296 The number of columns in the data to be copied
297 (denoted <em class="replaceable"><code>N</code></em> below).
298 </p></dd><dt><span class="term">Int16[<em class="replaceable"><code>N</code></em>]</span></dt><dd><p>
299 The format codes to be used for each column.
300 Each must presently be zero (text) or one (binary).
301 All must be zero if the overall copy format is textual.
302 </p></dd></dl></div></dd><dt id="PROTOCOL-MESSAGE-FORMATS-COPYBOTHRESPONSE"><span class="term">CopyBothResponse (B)</span> <a href="#PROTOCOL-MESSAGE-FORMATS-COPYBOTHRESPONSE" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('W')</span></dt><dd><p>
303 Identifies the message as a Start Copy Both response.
304 This message is used only for Streaming Replication.
305 </p></dd><dt><span class="term">Int32</span></dt><dd><p>
306 Length of message contents in bytes, including self.
307 </p></dd><dt><span class="term">Int8</span></dt><dd><p>
308 0 indicates the overall <code class="command">COPY</code> format
309 is textual (rows separated by newlines, columns
310 separated by separator characters, etc.). 1 indicates
311 the overall copy format is binary (similar to DataRow
312 format). See <a class="xref" href="sql-copy.html" title="COPY"><span class="refentrytitle">COPY</span></a> for more information.
313 </p></dd><dt><span class="term">Int16</span></dt><dd><p>
314 The number of columns in the data to be copied
315 (denoted <em class="replaceable"><code>N</code></em> below).
316 </p></dd><dt><span class="term">Int16[<em class="replaceable"><code>N</code></em>]</span></dt><dd><p>
317 The format codes to be used for each column.
318 Each must presently be zero (text) or one (binary).
319 All must be zero if the overall copy format is textual.
320 </p></dd></dl></div></dd><dt id="PROTOCOL-MESSAGE-FORMATS-DATAROW"><span class="term">DataRow (B)</span> <a href="#PROTOCOL-MESSAGE-FORMATS-DATAROW" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('D')</span></dt><dd><p>
321 Identifies the message as a data row.
322 </p></dd><dt><span class="term">Int32</span></dt><dd><p>
323 Length of message contents in bytes, including self.
324 </p></dd><dt><span class="term">Int16</span></dt><dd><p>
325 The number of column values that follow (possibly zero).
326 </p></dd></dl></div><p>
327 Next, the following pair of fields appear for each column:
328 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">Int32</span></dt><dd><p>
329 The length of the column value, in bytes (this count
330 does not include itself). Can be zero.
331 As a special case, -1 indicates a NULL column value.
332 No value bytes follow in the NULL case.
333 </p></dd><dt><span class="term">Byte<em class="replaceable"><code>n</code></em></span></dt><dd><p>
334 The value of the column, in the format indicated by the
335 associated format code.
336 <em class="replaceable"><code>n</code></em> is the above length.
337 </p></dd></dl></div></dd><dt id="PROTOCOL-MESSAGE-FORMATS-DESCRIBE"><span class="term">Describe (F)</span> <a href="#PROTOCOL-MESSAGE-FORMATS-DESCRIBE" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('D')</span></dt><dd><p>
338 Identifies the message as a Describe command.
339 </p></dd><dt><span class="term">Int32</span></dt><dd><p>
340 Length of message contents in bytes, including self.
341 </p></dd><dt><span class="term">Byte1</span></dt><dd><p>
342 '<code class="literal">S</code>' to describe a prepared statement; or
343 '<code class="literal">P</code>' to describe a portal.
344 </p></dd><dt><span class="term">String</span></dt><dd><p>
345 The name of the prepared statement or portal to describe
346 (an empty string selects the unnamed prepared statement
348 </p></dd></dl></div></dd><dt id="PROTOCOL-MESSAGE-FORMATS-EMPTYQUERYRESPONSE"><span class="term">EmptyQueryResponse (B)</span> <a href="#PROTOCOL-MESSAGE-FORMATS-EMPTYQUERYRESPONSE" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('I')</span></dt><dd><p>
349 Identifies the message as a response to an empty query string.
350 (This substitutes for CommandComplete.)
351 </p></dd><dt><span class="term">Int32(4)</span></dt><dd><p>
352 Length of message contents in bytes, including self.
353 </p></dd></dl></div></dd><dt id="PROTOCOL-MESSAGE-FORMATS-ERRORRESPONSE"><span class="term">ErrorResponse (B)</span> <a href="#PROTOCOL-MESSAGE-FORMATS-ERRORRESPONSE" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('E')</span></dt><dd><p>
354 Identifies the message as an error.
355 </p></dd><dt><span class="term">Int32</span></dt><dd><p>
356 Length of message contents in bytes, including self.
357 </p></dd></dl></div><p>
358 The message body consists of one or more identified fields,
359 followed by a zero byte as a terminator. Fields can appear in
360 any order. For each field there is the following:
361 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1</span></dt><dd><p>
362 A code identifying the field type; if zero, this is
363 the message terminator and no string follows.
364 The presently defined field types are listed in
365 <a class="xref" href="protocol-error-fields.html" title="54.8. Error and Notice Message Fields">Section 54.8</a>.
366 Since more field types might be added in future,
367 frontends should silently ignore fields of unrecognized
369 </p></dd><dt><span class="term">String</span></dt><dd><p>
371 </p></dd></dl></div></dd><dt id="PROTOCOL-MESSAGE-FORMATS-EXECUTE"><span class="term">Execute (F)</span> <a href="#PROTOCOL-MESSAGE-FORMATS-EXECUTE" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('E')</span></dt><dd><p>
372 Identifies the message as an Execute command.
373 </p></dd><dt><span class="term">Int32</span></dt><dd><p>
374 Length of message contents in bytes, including self.
375 </p></dd><dt><span class="term">String</span></dt><dd><p>
376 The name of the portal to execute
377 (an empty string selects the unnamed portal).
378 </p></dd><dt><span class="term">Int32</span></dt><dd><p>
379 Maximum number of rows to return, if portal contains
380 a query that returns rows (ignored otherwise). Zero
381 denotes <span class="quote">“<span class="quote">no limit</span>”</span>.
382 </p></dd></dl></div></dd><dt id="PROTOCOL-MESSAGE-FORMATS-FLUSH"><span class="term">Flush (F)</span> <a href="#PROTOCOL-MESSAGE-FORMATS-FLUSH" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('H')</span></dt><dd><p>
383 Identifies the message as a Flush command.
384 </p></dd><dt><span class="term">Int32(4)</span></dt><dd><p>
385 Length of message contents in bytes, including self.
386 </p></dd></dl></div></dd><dt id="PROTOCOL-MESSAGE-FORMATS-FUNCTIONCALL"><span class="term">FunctionCall (F)</span> <a href="#PROTOCOL-MESSAGE-FORMATS-FUNCTIONCALL" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('F')</span></dt><dd><p>
387 Identifies the message as a function call.
388 </p></dd><dt><span class="term">Int32</span></dt><dd><p>
389 Length of message contents in bytes, including self.
390 </p></dd><dt><span class="term">Int32</span></dt><dd><p>
391 Specifies the object ID of the function to call.
392 </p></dd><dt><span class="term">Int16</span></dt><dd><p>
393 The number of argument format codes that follow
394 (denoted <em class="replaceable"><code>C</code></em> below).
395 This can be zero to indicate that there are no arguments
396 or that the arguments all use the default format (text);
397 or one, in which case the specified format code is applied
398 to all arguments; or it can equal the actual number of
400 </p></dd><dt><span class="term">Int16[<em class="replaceable"><code>C</code></em>]</span></dt><dd><p>
401 The argument format codes. Each must presently be
402 zero (text) or one (binary).
403 </p></dd><dt><span class="term">Int16</span></dt><dd><p>
404 Specifies the number of arguments being supplied to the
406 </p></dd></dl></div><p>
407 Next, the following pair of fields appear for each argument:
408 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">Int32</span></dt><dd><p>
409 The length of the argument value, in bytes (this count
410 does not include itself). Can be zero.
411 As a special case, -1 indicates a NULL argument value.
412 No value bytes follow in the NULL case.
413 </p></dd><dt><span class="term">Byte<em class="replaceable"><code>n</code></em></span></dt><dd><p>
414 The value of the argument, in the format indicated by the
415 associated format code.
416 <em class="replaceable"><code>n</code></em> is the above length.
417 </p></dd></dl></div><p>
418 After the last argument, the following field appears:
419 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">Int16</span></dt><dd><p>
420 The format code for the function result. Must presently be
421 zero (text) or one (binary).
422 </p></dd></dl></div></dd><dt id="PROTOCOL-MESSAGE-FORMATS-FUNCTIONCALLRESPONSE"><span class="term">FunctionCallResponse (B)</span> <a href="#PROTOCOL-MESSAGE-FORMATS-FUNCTIONCALLRESPONSE" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('V')</span></dt><dd><p>
423 Identifies the message as a function call result.
424 </p></dd><dt><span class="term">Int32</span></dt><dd><p>
425 Length of message contents in bytes, including self.
426 </p></dd><dt><span class="term">Int32</span></dt><dd><p>
427 The length of the function result value, in bytes (this count
428 does not include itself). Can be zero.
429 As a special case, -1 indicates a NULL function result.
430 No value bytes follow in the NULL case.
431 </p></dd><dt><span class="term">Byte<em class="replaceable"><code>n</code></em></span></dt><dd><p>
432 The value of the function result, in the format indicated by
433 the associated format code.
434 <em class="replaceable"><code>n</code></em> is the above length.
435 </p></dd></dl></div></dd><dt id="PROTOCOL-MESSAGE-FORMATS-GSSENCREQUEST"><span class="term">GSSENCRequest (F)</span> <a href="#PROTOCOL-MESSAGE-FORMATS-GSSENCREQUEST" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Int32(8)</span></dt><dd><p>
436 Length of message contents in bytes, including self.
437 </p></dd><dt><span class="term">Int32(80877104)</span></dt><dd><p>
438 The <acronym class="acronym">GSSAPI</acronym> Encryption request code. The value is chosen to contain
439 <code class="literal">1234</code> in the most significant 16 bits, and <code class="literal">5680</code> in the
440 least significant 16 bits. (To avoid confusion, this code
441 must not be the same as any protocol version number.)
442 </p></dd></dl></div></dd><dt id="PROTOCOL-MESSAGE-FORMATS-GSSRESPONSE"><span class="term">GSSResponse (F)</span> <a href="#PROTOCOL-MESSAGE-FORMATS-GSSRESPONSE" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('p')</span></dt><dd><p>
443 Identifies the message as a GSSAPI or SSPI response. Note that
444 this is also used for SASL and password response messages.
445 The exact message type can be deduced from the context.
446 </p></dd><dt><span class="term">Int32</span></dt><dd><p>
447 Length of message contents in bytes, including self.
448 </p></dd><dt><span class="term">Byte<em class="replaceable"><code>n</code></em></span></dt><dd><p>
449 GSSAPI/SSPI specific message data.
450 </p></dd></dl></div></dd><dt id="PROTOCOL-MESSAGE-FORMATS-NEGOTIATEPROTOCOLVERSION"><span class="term">NegotiateProtocolVersion (B)</span> <a href="#PROTOCOL-MESSAGE-FORMATS-NEGOTIATEPROTOCOLVERSION" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('v')</span></dt><dd><p>
451 Identifies the message as a protocol version negotiation
453 </p></dd><dt><span class="term">Int32</span></dt><dd><p>
454 Length of message contents in bytes, including self.
455 </p></dd><dt><span class="term">Int32</span></dt><dd><p>
456 Newest minor protocol version supported by the server
457 for the major protocol version requested by the client.
458 </p></dd><dt><span class="term">Int32</span></dt><dd><p>
459 Number of protocol options not recognized by the server.
460 </p></dd></dl></div><p>
461 Then, for protocol option not recognized by the server, there
463 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">String</span></dt><dd><p>
465 </p></dd></dl></div></dd><dt id="PROTOCOL-MESSAGE-FORMATS-NODATA"><span class="term">NoData (B)</span> <a href="#PROTOCOL-MESSAGE-FORMATS-NODATA" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('n')</span></dt><dd><p>
466 Identifies the message as a no-data indicator.
467 </p></dd><dt><span class="term">Int32(4)</span></dt><dd><p>
468 Length of message contents in bytes, including self.
469 </p></dd></dl></div></dd><dt id="PROTOCOL-MESSAGE-FORMATS-NOTICERESPONSE"><span class="term">NoticeResponse (B)</span> <a href="#PROTOCOL-MESSAGE-FORMATS-NOTICERESPONSE" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('N')</span></dt><dd><p>
470 Identifies the message as a notice.
471 </p></dd><dt><span class="term">Int32</span></dt><dd><p>
472 Length of message contents in bytes, including self.
473 </p></dd></dl></div><p>
474 The message body consists of one or more identified fields,
475 followed by a zero byte as a terminator. Fields can appear in
476 any order. For each field there is the following:
477 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1</span></dt><dd><p>
478 A code identifying the field type; if zero, this is
479 the message terminator and no string follows.
480 The presently defined field types are listed in
481 <a class="xref" href="protocol-error-fields.html" title="54.8. Error and Notice Message Fields">Section 54.8</a>.
482 Since more field types might be added in future,
483 frontends should silently ignore fields of unrecognized
485 </p></dd><dt><span class="term">String</span></dt><dd><p>
487 </p></dd></dl></div></dd><dt id="PROTOCOL-MESSAGE-FORMATS-NOTIFICATIONRESPONSE"><span class="term">NotificationResponse (B)</span> <a href="#PROTOCOL-MESSAGE-FORMATS-NOTIFICATIONRESPONSE" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('A')</span></dt><dd><p>
488 Identifies the message as a notification response.
489 </p></dd><dt><span class="term">Int32</span></dt><dd><p>
490 Length of message contents in bytes, including self.
491 </p></dd><dt><span class="term">Int32</span></dt><dd><p>
492 The process ID of the notifying backend process.
493 </p></dd><dt><span class="term">String</span></dt><dd><p>
494 The name of the channel that the notify has been raised on.
495 </p></dd><dt><span class="term">String</span></dt><dd><p>
496 The <span class="quote">“<span class="quote">payload</span>”</span> string passed from the notifying process.
497 </p></dd></dl></div></dd><dt id="PROTOCOL-MESSAGE-FORMATS-PARAMETERDESCRIPTION"><span class="term">ParameterDescription (B)</span> <a href="#PROTOCOL-MESSAGE-FORMATS-PARAMETERDESCRIPTION" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('t')</span></dt><dd><p>
498 Identifies the message as a parameter description.
499 </p></dd><dt><span class="term">Int32</span></dt><dd><p>
500 Length of message contents in bytes, including self.
501 </p></dd><dt><span class="term">Int16</span></dt><dd><p>
502 The number of parameters used by the statement
504 </p></dd></dl></div><p>
505 Then, for each parameter, there is the following:
506 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">Int32</span></dt><dd><p>
507 Specifies the object ID of the parameter data type.
508 </p></dd></dl></div></dd><dt id="PROTOCOL-MESSAGE-FORMATS-PARAMETERSTATUS"><span class="term">ParameterStatus (B)</span> <a href="#PROTOCOL-MESSAGE-FORMATS-PARAMETERSTATUS" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('S')</span></dt><dd><p>
509 Identifies the message as a run-time parameter status report.
510 </p></dd><dt><span class="term">Int32</span></dt><dd><p>
511 Length of message contents in bytes, including self.
512 </p></dd><dt><span class="term">String</span></dt><dd><p>
513 The name of the run-time parameter being reported.
514 </p></dd><dt><span class="term">String</span></dt><dd><p>
515 The current value of the parameter.
516 </p></dd></dl></div></dd><dt id="PROTOCOL-MESSAGE-FORMATS-PARSE"><span class="term">Parse (F)</span> <a href="#PROTOCOL-MESSAGE-FORMATS-PARSE" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('P')</span></dt><dd><p>
517 Identifies the message as a Parse command.
518 </p></dd><dt><span class="term">Int32</span></dt><dd><p>
519 Length of message contents in bytes, including self.
520 </p></dd><dt><span class="term">String</span></dt><dd><p>
521 The name of the destination prepared statement
522 (an empty string selects the unnamed prepared statement).
523 </p></dd><dt><span class="term">String</span></dt><dd><p>
524 The query string to be parsed.
525 </p></dd><dt><span class="term">Int16</span></dt><dd><p>
526 The number of parameter data types specified
527 (can be zero). Note that this is not an indication of
528 the number of parameters that might appear in the
529 query string, only the number that the frontend wants to
530 prespecify types for.
531 </p></dd></dl></div><p>
532 Then, for each parameter, there is the following:
533 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">Int32</span></dt><dd><p>
534 Specifies the object ID of the parameter data type.
535 Placing a zero here is equivalent to leaving the type
537 </p></dd></dl></div></dd><dt id="PROTOCOL-MESSAGE-FORMATS-PARSECOMPLETE"><span class="term">ParseComplete (B)</span> <a href="#PROTOCOL-MESSAGE-FORMATS-PARSECOMPLETE" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('1')</span></dt><dd><p>
538 Identifies the message as a Parse-complete indicator.
539 </p></dd><dt><span class="term">Int32(4)</span></dt><dd><p>
540 Length of message contents in bytes, including self.
541 </p></dd></dl></div></dd><dt id="PROTOCOL-MESSAGE-FORMATS-PASSWORDMESSAGE"><span class="term">PasswordMessage (F)</span> <a href="#PROTOCOL-MESSAGE-FORMATS-PASSWORDMESSAGE" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('p')</span></dt><dd><p>
542 Identifies the message as a password response. Note that
543 this is also used for GSSAPI, SSPI and SASL response messages.
544 The exact message type can be deduced from the context.
545 </p></dd><dt><span class="term">Int32</span></dt><dd><p>
546 Length of message contents in bytes, including self.
547 </p></dd><dt><span class="term">String</span></dt><dd><p>
548 The password (encrypted, if requested).
549 </p></dd></dl></div></dd><dt id="PROTOCOL-MESSAGE-FORMATS-PORTALSUSPENDED"><span class="term">PortalSuspended (B)</span> <a href="#PROTOCOL-MESSAGE-FORMATS-PORTALSUSPENDED" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('s')</span></dt><dd><p>
550 Identifies the message as a portal-suspended indicator.
551 Note this only appears if an Execute message's row-count limit
553 </p></dd><dt><span class="term">Int32(4)</span></dt><dd><p>
554 Length of message contents in bytes, including self.
555 </p></dd></dl></div></dd><dt id="PROTOCOL-MESSAGE-FORMATS-QUERY"><span class="term">Query (F)</span> <a href="#PROTOCOL-MESSAGE-FORMATS-QUERY" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('Q')</span></dt><dd><p>
556 Identifies the message as a simple query.
557 </p></dd><dt><span class="term">Int32</span></dt><dd><p>
558 Length of message contents in bytes, including self.
559 </p></dd><dt><span class="term">String</span></dt><dd><p>
560 The query string itself.
561 </p></dd></dl></div></dd><dt id="PROTOCOL-MESSAGE-FORMATS-READYFORQUERY"><span class="term">ReadyForQuery (B)</span> <a href="#PROTOCOL-MESSAGE-FORMATS-READYFORQUERY" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('Z')</span></dt><dd><p>
562 Identifies the message type. ReadyForQuery is sent
563 whenever the backend is ready for a new query cycle.
564 </p></dd><dt><span class="term">Int32(5)</span></dt><dd><p>
565 Length of message contents in bytes, including self.
566 </p></dd><dt><span class="term">Byte1</span></dt><dd><p>
567 Current backend transaction status indicator.
568 Possible values are '<code class="literal">I</code>' if idle (not in
569 a transaction block); '<code class="literal">T</code>' if in a transaction
570 block; or '<code class="literal">E</code>' if in a failed transaction
571 block (queries will be rejected until block is ended).
572 </p></dd></dl></div></dd><dt id="PROTOCOL-MESSAGE-FORMATS-ROWDESCRIPTION"><span class="term">RowDescription (B)</span> <a href="#PROTOCOL-MESSAGE-FORMATS-ROWDESCRIPTION" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('T')</span></dt><dd><p>
573 Identifies the message as a row description.
574 </p></dd><dt><span class="term">Int32</span></dt><dd><p>
575 Length of message contents in bytes, including self.
576 </p></dd><dt><span class="term">Int16</span></dt><dd><p>
577 Specifies the number of fields in a row (can be zero).
578 </p></dd></dl></div><p>
579 Then, for each field, there is the following:
580 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">String</span></dt><dd><p>
582 </p></dd><dt><span class="term">Int32</span></dt><dd><p>
583 If the field can be identified as a column of a specific
584 table, the object ID of the table; otherwise zero.
585 </p></dd><dt><span class="term">Int16</span></dt><dd><p>
586 If the field can be identified as a column of a specific
587 table, the attribute number of the column; otherwise zero.
588 </p></dd><dt><span class="term">Int32</span></dt><dd><p>
589 The object ID of the field's data type.
590 </p></dd><dt><span class="term">Int16</span></dt><dd><p>
591 The data type size (see <code class="varname">pg_type.typlen</code>).
592 Note that negative values denote variable-width types.
593 </p></dd><dt><span class="term">Int32</span></dt><dd><p>
594 The type modifier (see <code class="varname">pg_attribute.atttypmod</code>).
595 The meaning of the modifier is type-specific.
596 </p></dd><dt><span class="term">Int16</span></dt><dd><p>
597 The format code being used for the field. Currently will
598 be zero (text) or one (binary). In a RowDescription
599 returned from the statement variant of Describe, the
600 format code is not yet known and will always be zero.
601 </p></dd></dl></div></dd><dt id="PROTOCOL-MESSAGE-FORMATS-SASLINITIALRESPONSE"><span class="term">SASLInitialResponse (F)</span> <a href="#PROTOCOL-MESSAGE-FORMATS-SASLINITIALRESPONSE" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('p')</span></dt><dd><p>
602 Identifies the message as an initial SASL response. Note that
603 this is also used for GSSAPI, SSPI and password response messages.
604 The exact message type is deduced from the context.
605 </p></dd><dt><span class="term">Int32</span></dt><dd><p>
606 Length of message contents in bytes, including self.
607 </p></dd><dt><span class="term">String</span></dt><dd><p>
608 Name of the SASL authentication mechanism that the client
610 </p></dd><dt><span class="term">Int32</span></dt><dd><p>
611 Length of SASL mechanism specific "Initial Client Response" that
612 follows, or -1 if there is no Initial Response.
613 </p></dd><dt><span class="term">Byte<em class="replaceable"><code>n</code></em></span></dt><dd><p>
614 SASL mechanism specific "Initial Response".
615 </p></dd></dl></div></dd><dt id="PROTOCOL-MESSAGE-FORMATS-SASLRESPONSE"><span class="term">SASLResponse (F)</span> <a href="#PROTOCOL-MESSAGE-FORMATS-SASLRESPONSE" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('p')</span></dt><dd><p>
616 Identifies the message as a SASL response. Note that
617 this is also used for GSSAPI, SSPI and password response messages.
618 The exact message type can be deduced from the context.
619 </p></dd><dt><span class="term">Int32</span></dt><dd><p>
620 Length of message contents in bytes, including self.
621 </p></dd><dt><span class="term">Byte<em class="replaceable"><code>n</code></em></span></dt><dd><p>
622 SASL mechanism specific message data.
623 </p></dd></dl></div></dd><dt id="PROTOCOL-MESSAGE-FORMATS-SSLREQUEST"><span class="term">SSLRequest (F)</span> <a href="#PROTOCOL-MESSAGE-FORMATS-SSLREQUEST" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Int32(8)</span></dt><dd><p>
624 Length of message contents in bytes, including self.
625 </p></dd><dt><span class="term">Int32(80877103)</span></dt><dd><p>
626 The <acronym class="acronym">SSL</acronym> request code. The value is chosen to contain
627 <code class="literal">1234</code> in the most significant 16 bits, and <code class="literal">5679</code> in the
628 least significant 16 bits. (To avoid confusion, this code
629 must not be the same as any protocol version number.)
630 </p></dd></dl></div></dd><dt id="PROTOCOL-MESSAGE-FORMATS-STARTUPMESSAGE"><span class="term">StartupMessage (F)</span> <a href="#PROTOCOL-MESSAGE-FORMATS-STARTUPMESSAGE" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Int32</span></dt><dd><p>
631 Length of message contents in bytes, including self.
632 </p></dd><dt><span class="term">Int32(196610)</span></dt><dd><p>
633 The protocol version number. The most significant 16 bits are
634 the major version number (3 for the protocol described here).
635 The least significant 16 bits are the minor version number
636 (2 for the protocol described here).
637 </p></dd></dl></div><p>
638 The protocol version number is followed by one or more pairs of
639 parameter name and value strings. A zero byte is required as a
640 terminator after the last name/value pair.
641 Parameters can appear in any
642 order. <code class="literal">user</code> is required, others are optional.
643 Each parameter is specified as:
644 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">String</span></dt><dd><p>
645 The parameter name. Currently recognized names are:
647 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="literal">user</code></span></dt><dd><p>
648 The database user name to connect as. Required;
650 </p></dd><dt><span class="term"><code class="literal">database</code></span></dt><dd><p>
651 The database to connect to. Defaults to the user name.
652 </p></dd><dt><span class="term"><code class="literal">options</code></span></dt><dd><p>
653 Command-line arguments for the backend. (This is
654 deprecated in favor of setting individual run-time
655 parameters.) Spaces within this string are
656 considered to separate arguments, unless escaped with
657 a backslash (<code class="literal">\</code>); write <code class="literal">\\</code> to
658 represent a literal backslash.
659 </p></dd><dt><span class="term"><code class="literal">replication</code></span></dt><dd><p>
660 Used to connect in streaming replication mode, where
661 a small set of replication commands can be issued
662 instead of SQL statements. Value can be
663 <code class="literal">true</code>, <code class="literal">false</code>, or
664 <code class="literal">database</code>, and the default is
665 <code class="literal">false</code>. See
666 <a class="xref" href="protocol-replication.html" title="54.4. Streaming Replication Protocol">Section 54.4</a> for details.
667 </p></dd></dl></div><p>
669 In addition to the above, other parameters may be listed.
670 Parameter names beginning with <code class="literal">_pq_.</code> are
671 reserved for use as protocol extensions, while others are
672 treated as run-time parameters to be set at backend start
673 time. Such settings will be applied during backend start
674 (after parsing the command-line arguments if any) and will
675 act as session defaults.
676 </p></dd><dt><span class="term">String</span></dt><dd><p>
678 </p></dd></dl></div></dd><dt id="PROTOCOL-MESSAGE-FORMATS-SYNC"><span class="term">Sync (F)</span> <a href="#PROTOCOL-MESSAGE-FORMATS-SYNC" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('S')</span></dt><dd><p>
679 Identifies the message as a Sync command.
680 </p></dd><dt><span class="term">Int32(4)</span></dt><dd><p>
681 Length of message contents in bytes, including self.
682 </p></dd></dl></div></dd><dt id="PROTOCOL-MESSAGE-FORMATS-TERMINATE"><span class="term">Terminate (F)</span> <a href="#PROTOCOL-MESSAGE-FORMATS-TERMINATE" class="id_link">#</a></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1('X')</span></dt><dd><p>
683 Identifies the message as a termination.
684 </p></dd><dt><span class="term">Int32(4)</span></dt><dd><p>
685 Length of message contents in bytes, including self.
686 </p></dd></dl></div></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-message-types.html" title="54.6. Message Data Types">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-error-fields.html" title="54.8. Error and Notice Message Fields">Next</a></td></tr><tr><td width="40%" align="left" valign="top">54.6. Message Data Types </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.8. Error and Notice Message Fields</td></tr></table></div></body></html>