codekingpro/portable-devtools
115k
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>55.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="55.6. Message Data Types" /><link rel="next" href="protocol-error-fields.html" title="55.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">55.7. Message Formats</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="protocol-message-types.html" title="55.6. Message Data Types">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="protocol.html" title="Chapter 55. Frontend/Backend Protocol">Up</a></td><th width="60%" align="center">Chapter 55. Frontend/Backend Protocol</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 16.3 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="protocol-error-fields.html" title="55.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">55.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 to4 indicate that it can be sent by a frontend (F), a backend (B), or both5 (F & B).6 Notice that although each message includes a byte count at the beginning,7 the message format is defined so that the message end can be found without8 reference to the byte count. This aids validity checking. (The CopyData9 message is an exception, because it forms part of a data stream; the contents10 of any individual CopyData message cannot be interpretable on their own.)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 the65 server's order of preference. A zero byte is required as terminator after66 the last authentication mechanism name. For each mechanism, there is the67 following:68 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 mechanism88 being used.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 be92 able to issue CancelRequest messages later.93 </p></dd><dt><span class="term">Int32(12)</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">Int32</span></dt><dd><p>98 The secret key of this backend.99 </p></dd></dl></div></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>100 Identifies the message as a Bind command.101 </p></dd><dt><span class="term">Int32</span></dt><dd><p>102 Length of message contents in bytes, including self.103 </p></dd><dt><span class="term">String</span></dt><dd><p>104 The name of the destination portal105 (an empty string selects the unnamed portal).106 </p></dd><dt><span class="term">String</span></dt><dd><p>107 The name of the source prepared statement108 (an empty string selects the unnamed prepared statement).109 </p></dd><dt><span class="term">Int16</span></dt><dd><p>110 The number of parameter format codes that follow111 (denoted <em class="replaceable"><code>C</code></em> below).112 This can be zero to indicate that there are no parameters113 or that the parameters all use the default format (text);114 or one, in which case the specified format code is applied115 to all parameters; or it can equal the actual number of116 parameters.117 </p></dd><dt><span class="term">Int16[<em class="replaceable"><code>C</code></em>]</span></dt><dd><p>118 The parameter format codes. Each must presently be119 zero (text) or one (binary).120 </p></dd><dt><span class="term">Int16</span></dt><dd><p>121 The number of parameter values that follow (possibly zero).122 This must match the number of parameters needed by the query.123 </p></dd></dl></div><p>124 Next, the following pair of fields appear for each parameter:125 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">Int32</span></dt><dd><p>126 The length of the parameter value, in bytes (this count127 does not include itself). Can be zero.128 As a special case, -1 indicates a NULL parameter value.129 No value bytes follow in the NULL case.130 </p></dd><dt><span class="term">Byte<em class="replaceable"><code>n</code></em></span></dt><dd><p>131 The value of the parameter, in the format indicated by the132 associated format code.133 <em class="replaceable"><code>n</code></em> is the above length.134 </p></dd></dl></div><p>135 After the last parameter, the following fields appear:136 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">Int16</span></dt><dd><p>137 The number of result-column format codes that follow138 (denoted <em class="replaceable"><code>R</code></em> below).139 This can be zero to indicate that there are no result columns140 or that the result columns should all use the default format141 (text);142 or one, in which case the specified format code is applied143 to all result columns (if any); or it can equal the actual144 number of result columns of the query.145 </p></dd><dt><span class="term">Int16[<em class="replaceable"><code>R</code></em>]</span></dt><dd><p>146 The result-column format codes. Each must presently be147 zero (text) or one (binary).148 </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>149 Identifies the message as a Bind-complete indicator.150 </p></dd><dt><span class="term">Int32(4)</span></dt><dd><p>151 Length of message contents in bytes, including self.152 </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>153 Length of message contents in bytes, including self.154 </p></dd><dt><span class="term">Int32(80877102)</span></dt><dd><p>155 The cancel request code. The value is chosen to contain156 <code class="literal">1234</code> in the most significant 16 bits, and <code class="literal">5678</code> in the157 least significant 16 bits. (To avoid confusion, this code158 must not be the same as any protocol version number.)159 </p></dd><dt><span class="term">Int32</span></dt><dd><p>160 The process ID of the target backend.161 </p></dd><dt><span class="term">Int32</span></dt><dd><p>162 The secret key for the target backend.163 </p></dd></dl></div></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>164 Identifies the message as a Close command.165 </p></dd><dt><span class="term">Int32</span></dt><dd><p>166 Length of message contents in bytes, including self.167 </p></dd><dt><span class="term">Byte1</span></dt><dd><p>168 '<code class="literal">S</code>' to close a prepared statement; or169 '<code class="literal">P</code>' to close a portal.170 </p></dd><dt><span class="term">String</span></dt><dd><p>171 The name of the prepared statement or portal to close172 (an empty string selects the unnamed prepared statement173 or portal).174 </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>175 Identifies the message as a Close-complete indicator.176 </p></dd><dt><span class="term">Int32(4)</span></dt><dd><p>177 Length of message contents in bytes, including self.178 </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>179 Identifies the message as a command-completed response.180 </p></dd><dt><span class="term">Int32</span></dt><dd><p>181 Length of message contents in bytes, including self.182 </p></dd><dt><span class="term">String</span></dt><dd><p>183 The command tag. This is usually a single184 word that identifies which SQL command was completed.185 </p><p>186 For an <code class="command">INSERT</code> command, the tag is187 <code class="literal">INSERT <em class="replaceable"><code>oid</code></em>188 <em class="replaceable"><code>rows</code></em></code>, where189 <em class="replaceable"><code>rows</code></em> is the number of rows190 inserted. <em class="replaceable"><code>oid</code></em> used to be the object ID191 of the inserted row if <em class="replaceable"><code>rows</code></em> was 1192 and the target table had OIDs, but OIDs system columns are193 not supported anymore; therefore <em class="replaceable"><code>oid</code></em>194 is always 0.195 </p><p>196 For a <code class="command">DELETE</code> command, the tag is197 <code class="literal">DELETE <em class="replaceable"><code>rows</code></em></code> where198 <em class="replaceable"><code>rows</code></em> is the number of rows deleted.199 </p><p>200 For an <code class="command">UPDATE</code> command, the tag is201 <code class="literal">UPDATE <em class="replaceable"><code>rows</code></em></code> where202 <em class="replaceable"><code>rows</code></em> is the number of rows updated.203 </p><p>204 For a <code class="command">MERGE</code> command, the tag is205 <code class="literal">MERGE <em class="replaceable"><code>rows</code></em></code> where206 <em class="replaceable"><code>rows</code></em> is the number of rows inserted,207 updated, or deleted.208 </p><p>209 For a <code class="command">SELECT</code> or <code class="command">CREATE TABLE AS</code>210 command, the tag is <code class="literal">SELECT <em class="replaceable"><code>rows</code></em></code>211 where <em class="replaceable"><code>rows</code></em> is the number of rows retrieved.212 </p><p>213 For a <code class="command">MOVE</code> command, the tag is214 <code class="literal">MOVE <em class="replaceable"><code>rows</code></em></code> where215 <em class="replaceable"><code>rows</code></em> is the number of rows the216 cursor's position has been changed by.217 </p><p>218 For a <code class="command">FETCH</code> command, the tag is219 <code class="literal">FETCH <em class="replaceable"><code>rows</code></em></code> where220 <em class="replaceable"><code>rows</code></em> is the number of rows that221 have been retrieved from the cursor.222 </p><p>223 For a <code class="command">COPY</code> command, the tag is224 <code class="literal">COPY <em class="replaceable"><code>rows</code></em></code> where225 <em class="replaceable"><code>rows</code></em> is the number of rows copied.226 (Note: the row count appears only in227 <span class="productname">PostgreSQL</span> 8.2 and later.)228 </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>229 Identifies the message as <code class="command">COPY</code> data.230 </p></dd><dt><span class="term">Int32</span></dt><dd><p>231 Length of message contents in bytes, including self.232 </p></dd><dt><span class="term">Byte<em class="replaceable"><code>n</code></em></span></dt><dd><p>233 Data that forms part of a <code class="command">COPY</code> data stream. Messages sent234 from the backend will always correspond to single data rows,235 but messages sent by frontends might divide the data stream236 arbitrarily.237 </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>238 Identifies the message as a <code class="command">COPY</code>-complete indicator.239 </p></dd><dt><span class="term">Int32(4)</span></dt><dd><p>240 Length of message contents in bytes, including self.241 </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>242 Identifies the message as a <code class="command">COPY</code>-failure indicator.243 </p></dd><dt><span class="term">Int32</span></dt><dd><p>244 Length of message contents in bytes, including self.245 </p></dd><dt><span class="term">String</span></dt><dd><p>246 An error message to report as the cause of failure.247 </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>248 Identifies the message as a Start Copy In response.249 The frontend must now send copy-in data (if not250 prepared to do so, send a CopyFail message).251 </p></dd><dt><span class="term">Int32</span></dt><dd><p>252 Length of message contents in bytes, including self.253 </p></dd><dt><span class="term">Int8</span></dt><dd><p>254 0 indicates the overall <code class="command">COPY</code> format is textual (rows255 separated by newlines, columns separated by separator256 characters, etc.).257 1 indicates the overall copy format is binary (similar258 to DataRow format).259 See <a class="xref" href="sql-copy.html" title="COPY"><span class="refentrytitle">COPY</span></a>260 for more information.261 </p></dd><dt><span class="term">Int16</span></dt><dd><p>262 The number of columns in the data to be copied263 (denoted <em class="replaceable"><code>N</code></em> below).264 </p></dd><dt><span class="term">Int16[<em class="replaceable"><code>N</code></em>]</span></dt><dd><p>265 The format codes to be used for each column.266 Each must presently be zero (text) or one (binary).267 All must be zero if the overall copy format is textual.268 </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>269 Identifies the message as a Start Copy Out response.270 This message will be followed by copy-out data.271 </p></dd><dt><span class="term">Int32</span></dt><dd><p>272 Length of message contents in bytes, including self.273 </p></dd><dt><span class="term">Int8</span></dt><dd><p>274 0 indicates the overall <code class="command">COPY</code> format275 is textual (rows separated by newlines, columns276 separated by separator characters, etc.). 1 indicates277 the overall copy format is binary (similar to DataRow278 format). See <a class="xref" href="sql-copy.html" title="COPY"><span class="refentrytitle">COPY</span></a> for more information.279 </p></dd><dt><span class="term">Int16</span></dt><dd><p>280 The number of columns in the data to be copied281 (denoted <em class="replaceable"><code>N</code></em> below).282 </p></dd><dt><span class="term">Int16[<em class="replaceable"><code>N</code></em>]</span></dt><dd><p>283 The format codes to be used for each column.284 Each must presently be zero (text) or one (binary).285 All must be zero if the overall copy format is textual.286 </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>287 Identifies the message as a Start Copy Both response.288 This message is used only for Streaming Replication.289 </p></dd><dt><span class="term">Int32</span></dt><dd><p>290 Length of message contents in bytes, including self.291 </p></dd><dt><span class="term">Int8</span></dt><dd><p>292 0 indicates the overall <code class="command">COPY</code> format293 is textual (rows separated by newlines, columns294 separated by separator characters, etc.). 1 indicates295 the overall copy format is binary (similar to DataRow296 format). See <a class="xref" href="sql-copy.html" title="COPY"><span class="refentrytitle">COPY</span></a> for more information.297 </p></dd><dt><span class="term">Int16</span></dt><dd><p>298 The number of columns in the data to be copied299 (denoted <em class="replaceable"><code>N</code></em> below).300 </p></dd><dt><span class="term">Int16[<em class="replaceable"><code>N</code></em>]</span></dt><dd><p>301 The format codes to be used for each column.302 Each must presently be zero (text) or one (binary).303 All must be zero if the overall copy format is textual.304 </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>305 Identifies the message as a data row.306 </p></dd><dt><span class="term">Int32</span></dt><dd><p>307 Length of message contents in bytes, including self.308 </p></dd><dt><span class="term">Int16</span></dt><dd><p>309 The number of column values that follow (possibly zero).310 </p></dd></dl></div><p>311 Next, the following pair of fields appear for each column:312 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">Int32</span></dt><dd><p>313 The length of the column value, in bytes (this count314 does not include itself). Can be zero.315 As a special case, -1 indicates a NULL column value.316 No value bytes follow in the NULL case.317 </p></dd><dt><span class="term">Byte<em class="replaceable"><code>n</code></em></span></dt><dd><p>318 The value of the column, in the format indicated by the319 associated format code.320 <em class="replaceable"><code>n</code></em> is the above length.321 </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>322 Identifies the message as a Describe command.323 </p></dd><dt><span class="term">Int32</span></dt><dd><p>324 Length of message contents in bytes, including self.325 </p></dd><dt><span class="term">Byte1</span></dt><dd><p>326 '<code class="literal">S</code>' to describe a prepared statement; or327 '<code class="literal">P</code>' to describe a portal.328 </p></dd><dt><span class="term">String</span></dt><dd><p>329 The name of the prepared statement or portal to describe330 (an empty string selects the unnamed prepared statement331 or portal).332 </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>333 Identifies the message as a response to an empty query string.334 (This substitutes for CommandComplete.)335 </p></dd><dt><span class="term">Int32(4)</span></dt><dd><p>336 Length of message contents in bytes, including self.337 </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>338 Identifies the message as an error.339 </p></dd><dt><span class="term">Int32</span></dt><dd><p>340 Length of message contents in bytes, including self.341 </p></dd></dl></div><p>342 The message body consists of one or more identified fields,343 followed by a zero byte as a terminator. Fields can appear in344 any order. For each field there is the following:345 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1</span></dt><dd><p>346 A code identifying the field type; if zero, this is347 the message terminator and no string follows.348 The presently defined field types are listed in349 <a class="xref" href="protocol-error-fields.html" title="55.8. Error and Notice Message Fields">Section 55.8</a>.350 Since more field types might be added in future,351 frontends should silently ignore fields of unrecognized352 type.353 </p></dd><dt><span class="term">String</span></dt><dd><p>354 The field value.355 </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>356 Identifies the message as an Execute command.357 </p></dd><dt><span class="term">Int32</span></dt><dd><p>358 Length of message contents in bytes, including self.359 </p></dd><dt><span class="term">String</span></dt><dd><p>360 The name of the portal to execute361 (an empty string selects the unnamed portal).362 </p></dd><dt><span class="term">Int32</span></dt><dd><p>363 Maximum number of rows to return, if portal contains364 a query that returns rows (ignored otherwise). Zero365 denotes <span class="quote">“<span class="quote">no limit</span>”</span>.366 </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>367 Identifies the message as a Flush command.368 </p></dd><dt><span class="term">Int32(4)</span></dt><dd><p>369 Length of message contents in bytes, including self.370 </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>371 Identifies the message as a function call.372 </p></dd><dt><span class="term">Int32</span></dt><dd><p>373 Length of message contents in bytes, including self.374 </p></dd><dt><span class="term">Int32</span></dt><dd><p>375 Specifies the object ID of the function to call.376 </p></dd><dt><span class="term">Int16</span></dt><dd><p>377 The number of argument format codes that follow378 (denoted <em class="replaceable"><code>C</code></em> below).379 This can be zero to indicate that there are no arguments380 or that the arguments all use the default format (text);381 or one, in which case the specified format code is applied382 to all arguments; or it can equal the actual number of383 arguments.384 </p></dd><dt><span class="term">Int16[<em class="replaceable"><code>C</code></em>]</span></dt><dd><p>385 The argument format codes. Each must presently be386 zero (text) or one (binary).387 </p></dd><dt><span class="term">Int16</span></dt><dd><p>388 Specifies the number of arguments being supplied to the389 function.390 </p></dd></dl></div><p>391 Next, the following pair of fields appear for each argument:392 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">Int32</span></dt><dd><p>393 The length of the argument value, in bytes (this count394 does not include itself). Can be zero.395 As a special case, -1 indicates a NULL argument value.396 No value bytes follow in the NULL case.397 </p></dd><dt><span class="term">Byte<em class="replaceable"><code>n</code></em></span></dt><dd><p>398 The value of the argument, in the format indicated by the399 associated format code.400 <em class="replaceable"><code>n</code></em> is the above length.401 </p></dd></dl></div><p>402 After the last argument, the following field appears:403 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">Int16</span></dt><dd><p>404 The format code for the function result. Must presently be405 zero (text) or one (binary).406 </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>407 Identifies the message as a function call result.408 </p></dd><dt><span class="term">Int32</span></dt><dd><p>409 Length of message contents in bytes, including self.410 </p></dd><dt><span class="term">Int32</span></dt><dd><p>411 The length of the function result value, in bytes (this count412 does not include itself). Can be zero.413 As a special case, -1 indicates a NULL function result.414 No value bytes follow in the NULL case.415 </p></dd><dt><span class="term">Byte<em class="replaceable"><code>n</code></em></span></dt><dd><p>416 The value of the function result, in the format indicated by417 the associated format code.418 <em class="replaceable"><code>n</code></em> is the above length.419 </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>420 Length of message contents in bytes, including self.421 </p></dd><dt><span class="term">Int32(80877104)</span></dt><dd><p>422 The <acronym class="acronym">GSSAPI</acronym> Encryption request code. The value is chosen to contain423 <code class="literal">1234</code> in the most significant 16 bits, and <code class="literal">5680</code> in the424 least significant 16 bits. (To avoid confusion, this code425 must not be the same as any protocol version number.)426 </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>427 Identifies the message as a GSSAPI or SSPI response. Note that428 this is also used for SASL and password response messages.429 The exact message type can be deduced from the context.430 </p></dd><dt><span class="term">Int32</span></dt><dd><p>431 Length of message contents in bytes, including self.432 </p></dd><dt><span class="term">Byte<em class="replaceable"><code>n</code></em></span></dt><dd><p>433 GSSAPI/SSPI specific message data.434 </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>435 Identifies the message as a protocol version negotiation436 message.437 </p></dd><dt><span class="term">Int32</span></dt><dd><p>438 Length of message contents in bytes, including self.439 </p></dd><dt><span class="term">Int32</span></dt><dd><p>440 Newest minor protocol version supported by the server441 for the major protocol version requested by the client.442 </p></dd><dt><span class="term">Int32</span></dt><dd><p>443 Number of protocol options not recognized by the server.444 </p></dd></dl></div><p>445 Then, for protocol option not recognized by the server, there446 is the following:447 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">String</span></dt><dd><p>448 The option name.449 </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>450 Identifies the message as a no-data indicator.451 </p></dd><dt><span class="term">Int32(4)</span></dt><dd><p>452 Length of message contents in bytes, including self.453 </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>454 Identifies the message as a notice.455 </p></dd><dt><span class="term">Int32</span></dt><dd><p>456 Length of message contents in bytes, including self.457 </p></dd></dl></div><p>458 The message body consists of one or more identified fields,459 followed by a zero byte as a terminator. Fields can appear in460 any order. For each field there is the following:461 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">Byte1</span></dt><dd><p>462 A code identifying the field type; if zero, this is463 the message terminator and no string follows.464 The presently defined field types are listed in465 <a class="xref" href="protocol-error-fields.html" title="55.8. Error and Notice Message Fields">Section 55.8</a>.466 Since more field types might be added in future,467 frontends should silently ignore fields of unrecognized468 type.469 </p></dd><dt><span class="term">String</span></dt><dd><p>470 The field value.471 </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>472 Identifies the message as a notification response.473 </p></dd><dt><span class="term">Int32</span></dt><dd><p>474 Length of message contents in bytes, including self.475 </p></dd><dt><span class="term">Int32</span></dt><dd><p>476 The process ID of the notifying backend process.477 </p></dd><dt><span class="term">String</span></dt><dd><p>478 The name of the channel that the notify has been raised on.479 </p></dd><dt><span class="term">String</span></dt><dd><p>480 The <span class="quote">“<span class="quote">payload</span>”</span> string passed from the notifying process.481 </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>482 Identifies the message as a parameter description.483 </p></dd><dt><span class="term">Int32</span></dt><dd><p>484 Length of message contents in bytes, including self.485 </p></dd><dt><span class="term">Int16</span></dt><dd><p>486 The number of parameters used by the statement487 (can be zero).488 </p></dd></dl></div><p>489 Then, for each parameter, there is the following:490 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">Int32</span></dt><dd><p>491 Specifies the object ID of the parameter data type.492 </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>493 Identifies the message as a run-time parameter status report.494 </p></dd><dt><span class="term">Int32</span></dt><dd><p>495 Length of message contents in bytes, including self.496 </p></dd><dt><span class="term">String</span></dt><dd><p>497 The name of the run-time parameter being reported.498 </p></dd><dt><span class="term">String</span></dt><dd><p>499 The current value of the parameter.500 </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>501 Identifies the message as a Parse command.502 </p></dd><dt><span class="term">Int32</span></dt><dd><p>503 Length of message contents in bytes, including self.504 </p></dd><dt><span class="term">String</span></dt><dd><p>505 The name of the destination prepared statement506 (an empty string selects the unnamed prepared statement).507 </p></dd><dt><span class="term">String</span></dt><dd><p>508 The query string to be parsed.509 </p></dd><dt><span class="term">Int16</span></dt><dd><p>510 The number of parameter data types specified511 (can be zero). Note that this is not an indication of512 the number of parameters that might appear in the513 query string, only the number that the frontend wants to514 prespecify types for.515 </p></dd></dl></div><p>516 Then, for each parameter, there is the following:517 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">Int32</span></dt><dd><p>518 Specifies the object ID of the parameter data type.519 Placing a zero here is equivalent to leaving the type520 unspecified.521 </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>522 Identifies the message as a Parse-complete indicator.523 </p></dd><dt><span class="term">Int32(4)</span></dt><dd><p>524 Length of message contents in bytes, including self.525 </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>526 Identifies the message as a password response. Note that527 this is also used for GSSAPI, SSPI and SASL response messages.528 The exact message type can be deduced from the context.529 </p></dd><dt><span class="term">Int32</span></dt><dd><p>530 Length of message contents in bytes, including self.531 </p></dd><dt><span class="term">String</span></dt><dd><p>532 The password (encrypted, if requested).533 </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>534 Identifies the message as a portal-suspended indicator.535 Note this only appears if an Execute message's row-count limit536 was reached.537 </p></dd><dt><span class="term">Int32(4)</span></dt><dd><p>538 Length of message contents in bytes, including self.539 </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>540 Identifies the message as a simple query.541 </p></dd><dt><span class="term">Int32</span></dt><dd><p>542 Length of message contents in bytes, including self.543 </p></dd><dt><span class="term">String</span></dt><dd><p>544 The query string itself.545 </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>546 Identifies the message type. ReadyForQuery is sent547 whenever the backend is ready for a new query cycle.548 </p></dd><dt><span class="term">Int32(5)</span></dt><dd><p>549 Length of message contents in bytes, including self.550 </p></dd><dt><span class="term">Byte1</span></dt><dd><p>551 Current backend transaction status indicator.552 Possible values are '<code class="literal">I</code>' if idle (not in553 a transaction block); '<code class="literal">T</code>' if in a transaction554 block; or '<code class="literal">E</code>' if in a failed transaction555 block (queries will be rejected until block is ended).556 </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>557 Identifies the message as a row description.558 </p></dd><dt><span class="term">Int32</span></dt><dd><p>559 Length of message contents in bytes, including self.560 </p></dd><dt><span class="term">Int16</span></dt><dd><p>561 Specifies the number of fields in a row (can be zero).562 </p></dd></dl></div><p>563 Then, for each field, there is the following:564 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">String</span></dt><dd><p>565 The field name.566 </p></dd><dt><span class="term">Int32</span></dt><dd><p>567 If the field can be identified as a column of a specific568 table, the object ID of the table; otherwise zero.569 </p></dd><dt><span class="term">Int16</span></dt><dd><p>570 If the field can be identified as a column of a specific571 table, the attribute number of the column; otherwise zero.572 </p></dd><dt><span class="term">Int32</span></dt><dd><p>573 The object ID of the field's data type.574 </p></dd><dt><span class="term">Int16</span></dt><dd><p>575 The data type size (see <code class="varname">pg_type.typlen</code>).576 Note that negative values denote variable-width types.577 </p></dd><dt><span class="term">Int32</span></dt><dd><p>578 The type modifier (see <code class="varname">pg_attribute.atttypmod</code>).579 The meaning of the modifier is type-specific.580 </p></dd><dt><span class="term">Int16</span></dt><dd><p>581 The format code being used for the field. Currently will582 be zero (text) or one (binary). In a RowDescription583 returned from the statement variant of Describe, the584 format code is not yet known and will always be zero.585 </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>586 Identifies the message as an initial SASL response. Note that587 this is also used for GSSAPI, SSPI and password response messages.588 The exact message type is deduced from the context.589 </p></dd><dt><span class="term">Int32</span></dt><dd><p>590 Length of message contents in bytes, including self.591 </p></dd><dt><span class="term">String</span></dt><dd><p>592 Name of the SASL authentication mechanism that the client593 selected.594 </p></dd><dt><span class="term">Int32</span></dt><dd><p>595 Length of SASL mechanism specific "Initial Client Response" that596 follows, or -1 if there is no Initial Response.597 </p></dd><dt><span class="term">Byte<em class="replaceable"><code>n</code></em></span></dt><dd><p>598 SASL mechanism specific "Initial Response".599 </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>600 Identifies the message as a SASL response. Note that601 this is also used for GSSAPI, SSPI and password response messages.602 The exact message type can be deduced from the context.603 </p></dd><dt><span class="term">Int32</span></dt><dd><p>604 Length of message contents in bytes, including self.605 </p></dd><dt><span class="term">Byte<em class="replaceable"><code>n</code></em></span></dt><dd><p>606 SASL mechanism specific message data.607 </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>608 Length of message contents in bytes, including self.609 </p></dd><dt><span class="term">Int32(80877103)</span></dt><dd><p>610 The <acronym class="acronym">SSL</acronym> request code. The value is chosen to contain611 <code class="literal">1234</code> in the most significant 16 bits, and <code class="literal">5679</code> in the612 least significant 16 bits. (To avoid confusion, this code613 must not be the same as any protocol version number.)614 </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>615 Length of message contents in bytes, including self.616 </p></dd><dt><span class="term">Int32(196608)</span></dt><dd><p>617 The protocol version number. The most significant 16 bits are618 the major version number (3 for the protocol described here).619 The least significant 16 bits are the minor version number620 (0 for the protocol described here).621 </p></dd></dl></div><p>622 The protocol version number is followed by one or more pairs of623 parameter name and value strings. A zero byte is required as a624 terminator after the last name/value pair.625 Parameters can appear in any626 order. <code class="literal">user</code> is required, others are optional.627 Each parameter is specified as:628 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">String</span></dt><dd><p>629 The parameter name. Currently recognized names are:630 631 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="literal">user</code></span></dt><dd><p>632 The database user name to connect as. Required;633 there is no default.634 </p></dd><dt><span class="term"><code class="literal">database</code></span></dt><dd><p>635 The database to connect to. Defaults to the user name.636 </p></dd><dt><span class="term"><code class="literal">options</code></span></dt><dd><p>637 Command-line arguments for the backend. (This is638 deprecated in favor of setting individual run-time639 parameters.) Spaces within this string are640 considered to separate arguments, unless escaped with641 a backslash (<code class="literal">\</code>); write <code class="literal">\\</code> to642 represent a literal backslash.643 </p></dd><dt><span class="term"><code class="literal">replication</code></span></dt><dd><p>644 Used to connect in streaming replication mode, where645 a small set of replication commands can be issued646 instead of SQL statements. Value can be647 <code class="literal">true</code>, <code class="literal">false</code>, or648 <code class="literal">database</code>, and the default is649 <code class="literal">false</code>. See650 <a class="xref" href="protocol-replication.html" title="55.4. Streaming Replication Protocol">Section 55.4</a> for details.651 </p></dd></dl></div><p>652 653 In addition to the above, other parameters may be listed.654 Parameter names beginning with <code class="literal">_pq_.</code> are655 reserved for use as protocol extensions, while others are656 treated as run-time parameters to be set at backend start657 time. Such settings will be applied during backend start658 (after parsing the command-line arguments if any) and will659 act as session defaults.660 </p></dd><dt><span class="term">String</span></dt><dd><p>661 The parameter value.662 </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>663 Identifies the message as a Sync command.664 </p></dd><dt><span class="term">Int32(4)</span></dt><dd><p>665 Length of message contents in bytes, including self.666 </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>667 Identifies the message as a termination.668 </p></dd><dt><span class="term">Int32(4)</span></dt><dd><p>669 Length of message contents in bytes, including self.670 </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="55.6. Message Data Types">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="protocol.html" title="Chapter 55. Frontend/Backend Protocol">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="protocol-error-fields.html" title="55.8. Error and Notice Message Fields">Next</a></td></tr><tr><td width="40%" align="left" valign="top">55.6. Message Data Types </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 16.3 Documentation">Home</a></td><td width="40%" align="right" valign="top"> 55.8. Error and Notice Message Fields</td></tr></table></div></body></html>