1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940
|
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>43.4.Message Formats</title>
<link rel="stylesheet" href="stylesheet.css" type="text/css">
<link rev="made" href="pgsql-docs@postgresql.org">
<meta name="generator" content="DocBook XSL Stylesheets V1.70.0">
<link rel="start" href="index.html" title="PostgreSQL 8.1.4 Documentation">
<link rel="up" href="protocol.html" title="Chapter43.Frontend/Backend Protocol">
<link rel="prev" href="protocol-message-types.html" title="43.3.Message Data Types">
<link rel="next" href="protocol-error-fields.html" title="43.5.Error and Notice Message Fields">
<link rel="copyright" href="ln-legalnotice.html" title="Legal Notice">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="sect1" lang="en">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="protocol-message-formats"></a>43.4.Message Formats</h2></div></div></div>
<p>This section describes the detailed format of each message. Each is marked to
indicate that it may be sent by a frontend (F), a backend (B), or both
(F & B).
Notice that although each message includes a byte count at the beginning,
the message format is defined so that the message end can be found without
reference to the byte count. This aids validity checking. (The CopyData
message is an exception, because it forms part of a data stream; the contents
of any individual CopyData message may not be interpretable on their own.)</p>
<div class="variablelist"><dl>
<dt><span class="term">AuthenticationOk (B)</span></dt>
<dd>
<p>
</p>
<div class="variablelist"><dl>
<dt><span class="term"> Byte1('R')</span></dt>
<dd><p> Identifies the message as an authentication request.</p></dd>
<dt><span class="term"> Int32(8)</span></dt>
<dd><p> Length of message contents in bytes, including self.</p></dd>
<dt><span class="term"> Int32(0)</span></dt>
<dd><p> Specifies that the authentication was successful.</p></dd>
</dl></div>
<p>
</p>
</dd>
<dt><span class="term">AuthenticationKerberosV5 (B)</span></dt>
<dd>
<p>
</p>
<div class="variablelist"><dl>
<dt><span class="term"> Byte1('R')</span></dt>
<dd><p> Identifies the message as an authentication request.</p></dd>
<dt><span class="term"> Int32(8)</span></dt>
<dd><p> Length of message contents in bytes, including self.</p></dd>
<dt><span class="term"> Int32(2)</span></dt>
<dd><p> Specifies that Kerberos V5 authentication is required.</p></dd>
</dl></div>
</dd>
<dt><span class="term">AuthenticationCleartextPassword (B)</span></dt>
<dd>
<p>
</p>
<div class="variablelist"><dl>
<dt><span class="term"> Byte1('R')</span></dt>
<dd><p> Identifies the message as an authentication request.</p></dd>
<dt><span class="term"> Int32(8)</span></dt>
<dd><p> Length of message contents in bytes, including self.</p></dd>
<dt><span class="term"> Int32(3)</span></dt>
<dd><p> Specifies that a clear-text password is required.</p></dd>
</dl></div>
</dd>
<dt><span class="term">AuthenticationCryptPassword (B)</span></dt>
<dd>
<p>
</p>
<div class="variablelist"><dl>
<dt><span class="term"> Byte1('R')</span></dt>
<dd><p> Identifies the message as an authentication request.</p></dd>
<dt><span class="term"> Int32(10)</span></dt>
<dd><p> Length of message contents in bytes, including self.</p></dd>
<dt><span class="term"> Int32(4)</span></dt>
<dd><p> Specifies that a crypt()-encrypted password is required.</p></dd>
<dt><span class="term"> Byte2</span></dt>
<dd><p> The salt to use when encrypting the password.</p></dd>
</dl></div>
<p>
</p>
</dd>
<dt><span class="term">AuthenticationMD5Password (B)</span></dt>
<dd>
<p>
</p>
<div class="variablelist"><dl>
<dt><span class="term"> Byte1('R')</span></dt>
<dd><p> Identifies the message as an authentication request.</p></dd>
<dt><span class="term"> Int32(12)</span></dt>
<dd><p> Length of message contents in bytes, including self.</p></dd>
<dt><span class="term"> Int32(5)</span></dt>
<dd><p> Specifies that an MD5-encrypted password is required.</p></dd>
<dt><span class="term"> Byte4</span></dt>
<dd><p> The salt to use when encrypting the password.</p></dd>
</dl></div>
<p>
</p>
</dd>
<dt><span class="term">AuthenticationSCMCredential (B)</span></dt>
<dd>
<p>
</p>
<div class="variablelist"><dl>
<dt><span class="term"> Byte1('R')</span></dt>
<dd><p> Identifies the message as an authentication request.</p></dd>
<dt><span class="term"> Int32(8)</span></dt>
<dd><p> Length of message contents in bytes, including self.</p></dd>
<dt><span class="term"> Int32(6)</span></dt>
<dd><p> Specifies that an SCM credentials message is required.</p></dd>
</dl></div>
<p>
</p>
</dd>
<dt><span class="term">BackendKeyData (B)</span></dt>
<dd>
<p>
</p>
<div class="variablelist"><dl>
<dt><span class="term"> Byte1('K')</span></dt>
<dd><p> Identifies the message as cancellation key data.
The frontend must save these values if it wishes to be
able to issue CancelRequest messages later.</p></dd>
<dt><span class="term"> Int32(12)</span></dt>
<dd><p> Length of message contents in bytes, including self.</p></dd>
<dt><span class="term"> Int32</span></dt>
<dd><p> The process ID of this backend.</p></dd>
<dt><span class="term"> Int32</span></dt>
<dd><p> The secret key of this backend.</p></dd>
</dl></div>
<p>
</p>
</dd>
<dt><span class="term">Bind (F)</span></dt>
<dd>
<p>
</p>
<div class="variablelist"><dl>
<dt><span class="term"> Byte1('B')</span></dt>
<dd><p> Identifies the message as a Bind command.</p></dd>
<dt><span class="term"> Int32</span></dt>
<dd><p> Length of message contents in bytes, including self.</p></dd>
<dt><span class="term"> String</span></dt>
<dd><p> The name of the destination portal
(an empty string selects the unnamed portal).</p></dd>
<dt><span class="term"> String</span></dt>
<dd><p> The name of the source prepared statement
(an empty string selects the unnamed prepared statement).</p></dd>
<dt><span class="term"> Int16</span></dt>
<dd><p> The number of parameter format codes that follow
(denoted <em class="replaceable"><code>C</code></em> below).
This can be zero to indicate that there are no parameters
or that the parameters all use the default format (text);
or one, in which case the specified format code is applied
to all parameters; or it can equal the actual number of
parameters.</p></dd>
<dt><span class="term"> Int16[<em class="replaceable"><code>C</code></em>]</span></dt>
<dd><p> The parameter format codes. Each must presently be
zero (text) or one (binary).</p></dd>
<dt><span class="term"> Int16</span></dt>
<dd><p> The number of parameter values that follow (possibly zero).
This must match the number of parameters needed by the query.</p></dd>
</dl></div>
<p>
Next, the following pair of fields appear for each parameter:
</p>
<div class="variablelist"><dl>
<dt><span class="term"> Int32</span></dt>
<dd><p> The length of the parameter value, in bytes (this count
does not include itself). Can be zero.
As a special case, -1 indicates a NULL parameter value.
No value bytes follow in the NULL case.</p></dd>
<dt><span class="term"> Byte<em class="replaceable"><code>n</code></em></span></dt>
<dd><p> The value of the parameter, in the format indicated by the
associated format code.
<em class="replaceable"><code>n</code></em> is the above length.</p></dd>
</dl></div>
<p>
After the last parameter, the following fields appear:
</p>
<div class="variablelist"><dl>
<dt><span class="term"> Int16</span></dt>
<dd><p> The number of result-column format codes that follow
(denoted <em class="replaceable"><code>R</code></em> below).
This can be zero to indicate that there are no result columns
or that the result columns should all use the default format
(text);
or one, in which case the specified format code is applied
to all result columns (if any); or it can equal the actual
number of result columns of the query.</p></dd>
<dt><span class="term"> Int16[<em class="replaceable"><code>R</code></em>]</span></dt>
<dd><p> The result-column format codes. Each must presently be
zero (text) or one (binary).</p></dd>
</dl></div>
</dd>
<dt><span class="term">BindComplete (B)</span></dt>
<dd>
<p>
</p>
<div class="variablelist"><dl>
<dt><span class="term"> Byte1('2')</span></dt>
<dd><p> Identifies the message as a Bind-complete indicator.</p></dd>
<dt><span class="term"> Int32(4)</span></dt>
<dd><p> Length of message contents in bytes, including self.</p></dd>
</dl></div>
<p>
</p>
</dd>
<dt><span class="term">CancelRequest (F)</span></dt>
<dd>
<p>
</p>
<div class="variablelist"><dl>
<dt><span class="term"> Int32(16)</span></dt>
<dd><p> Length of message contents in bytes, including self.</p></dd>
<dt><span class="term"> Int32(80877102)</span></dt>
<dd><p> The cancel request code. The value is chosen to contain
<code class="literal">1234</code> in the most significant 16 bits, and <code class="literal">5678</code> in the
least 16 significant bits. (To avoid confusion, this code
must not be the same as any protocol version number.)</p></dd>
<dt><span class="term"> Int32</span></dt>
<dd><p> The process ID of the target backend.</p></dd>
<dt><span class="term"> Int32</span></dt>
<dd><p> The secret key for the target backend.</p></dd>
</dl></div>
<p>
</p>
</dd>
<dt><span class="term">Close (F)</span></dt>
<dd>
<p>
</p>
<div class="variablelist"><dl>
<dt><span class="term"> Byte1('C')</span></dt>
<dd><p> Identifies the message as a Close command.</p></dd>
<dt><span class="term"> Int32</span></dt>
<dd><p> Length of message contents in bytes, including self.</p></dd>
<dt><span class="term"> Byte1</span></dt>
<dd><p> '<code class="literal">S</code>' to close a prepared statement; or
'<code class="literal">P</code>' to close a portal.</p></dd>
<dt><span class="term"> String</span></dt>
<dd><p> The name of the prepared statement or portal to close
(an empty string selects the unnamed prepared statement
or portal).</p></dd>
</dl></div>
</dd>
<dt><span class="term">CloseComplete (B)</span></dt>
<dd>
<p>
</p>
<div class="variablelist"><dl>
<dt><span class="term"> Byte1('3')</span></dt>
<dd><p> Identifies the message as a Close-complete indicator.</p></dd>
<dt><span class="term"> Int32(4)</span></dt>
<dd><p> Length of message contents in bytes, including self.</p></dd>
</dl></div>
<p>
</p>
</dd>
<dt><span class="term">CommandComplete (B)</span></dt>
<dd>
<p>
</p>
<div class="variablelist"><dl>
<dt><span class="term"> Byte1('C')</span></dt>
<dd><p> Identifies the message as a command-completed response.</p></dd>
<dt><span class="term"> Int32</span></dt>
<dd><p> Length of message contents in bytes, including self.</p></dd>
<dt><span class="term"> String</span></dt>
<dd>
<p> The command tag. This is usually a single
word that identifies which SQL command was completed.
</p>
<p> For an <code class="command">INSERT</code> command, the tag is
<code class="literal">INSERT <em class="replaceable"><code>oid</code></em>
<em class="replaceable"><code>rows</code></em></code>, where
<em class="replaceable"><code>rows</code></em> is the number of rows
inserted. <em class="replaceable"><code>oid</code></em> is the object ID
of the inserted row if <em class="replaceable"><code>rows</code></em> is 1
and the target table has OIDs;
otherwise <em class="replaceable"><code>oid</code></em> is 0.
</p>
<p> For a <code class="command">DELETE</code> command, the tag is
<code class="literal">DELETE <em class="replaceable"><code>rows</code></em></code> where
<em class="replaceable"><code>rows</code></em> is the number of rows deleted.
</p>
<p> For an <code class="command">UPDATE</code> command, the tag is
<code class="literal">UPDATE <em class="replaceable"><code>rows</code></em></code> where
<em class="replaceable"><code>rows</code></em> is the number of rows updated.
</p>
<p> For a <code class="command">MOVE</code> command, the tag is
<code class="literal">MOVE <em class="replaceable"><code>rows</code></em></code> where
<em class="replaceable"><code>rows</code></em> is the number of rows the
cursor's position has been changed by.
</p>
<p> For a <code class="command">FETCH</code> command, the tag is
<code class="literal">FETCH <em class="replaceable"><code>rows</code></em></code> where
<em class="replaceable"><code>rows</code></em> is the number of rows that
have been retrieved from the cursor.</p>
</dd>
</dl></div>
<p>
</p>
</dd>
<dt><span class="term">CopyData (F & B)</span></dt>
<dd><div class="variablelist"><dl>
<dt><span class="term"> Byte1('d')</span></dt>
<dd><p> Identifies the message as <code class="command">COPY</code> data.</p></dd>
<dt><span class="term"> Int32</span></dt>
<dd><p> Length of message contents in bytes, including self.</p></dd>
<dt><span class="term"> Byte<em class="replaceable"><code>n</code></em></span></dt>
<dd><p> Data that forms part of a <code class="command">COPY</code> data stream. Messages sent
from the backend will always correspond to single data rows,
but messages sent by frontends may divide the data stream
arbitrarily.</p></dd>
</dl></div></dd>
<dt><span class="term">CopyDone (F & B)</span></dt>
<dd>
<p>
</p>
<div class="variablelist"><dl>
<dt><span class="term"> Byte1('c')</span></dt>
<dd><p> Identifies the message as a <code class="command">COPY</code>-complete indicator.</p></dd>
<dt><span class="term"> Int32(4)</span></dt>
<dd><p> Length of message contents in bytes, including self.</p></dd>
</dl></div>
<p>
</p>
</dd>
<dt><span class="term">CopyFail (F)</span></dt>
<dd>
<p>
</p>
<div class="variablelist"><dl>
<dt><span class="term"> Byte1('f')</span></dt>
<dd><p> Identifies the message as a <code class="command">COPY</code>-failure indicator.</p></dd>
<dt><span class="term"> Int32</span></dt>
<dd><p> Length of message contents in bytes, including self.</p></dd>
<dt><span class="term"> String</span></dt>
<dd><p> An error message to report as the cause of failure.</p></dd>
</dl></div>
<p>
</p>
</dd>
<dt><span class="term">CopyInResponse (B)</span></dt>
<dd>
<p>
</p>
<div class="variablelist"><dl>
<dt><span class="term"> Byte1('G')</span></dt>
<dd><p> Identifies the message as a Start Copy In response.
The frontend must now send copy-in data (if not
prepared to do so, send a CopyFail message).</p></dd>
<dt><span class="term"> Int32</span></dt>
<dd><p> Length of message contents in bytes, including self.</p></dd>
<dt><span class="term"> Int8</span></dt>
<dd><p> 0 indicates the overall <code class="command">COPY</code> format is textual (rows
separated by newlines, columns separated by separator
characters, etc).
1 indicates the overall copy format is binary (similar
to DataRow format).
See <a href="sql-copy.html">COPY</a>
for more information.</p></dd>
<dt><span class="term"> Int16</span></dt>
<dd><p> The number of columns in the data to be copied
(denoted <em class="replaceable"><code>N</code></em> below).</p></dd>
<dt><span class="term"> Int16[<em class="replaceable"><code>N</code></em>]</span></dt>
<dd><p> The format codes to be used for each column.
Each must presently be zero (text) or one (binary).
All must be zero if the overall copy format is textual.</p></dd>
</dl></div>
<p>
</p>
</dd>
<dt><span class="term">CopyOutResponse (B)</span></dt>
<dd>
<p>
</p>
<div class="variablelist"><dl>
<dt><span class="term"> Byte1('H')</span></dt>
<dd><p> Identifies the message as a Start Copy Out response.
This message will be followed by copy-out data.</p></dd>
<dt><span class="term"> Int32</span></dt>
<dd><p> Length of message contents in bytes, including self.</p></dd>
<dt><span class="term"> Int8</span></dt>
<dd><p> 0 indicates the overall <code class="command">COPY</code> format
is textual (rows separated by newlines, columns
separated by separator characters, etc). 1 indicates
the overall copy format is binary (similar to DataRow
format). See <a href="sql-copy.html">COPY</a> for more information. </p></dd>
<dt><span class="term"> Int16</span></dt>
<dd><p> The number of columns in the data to be copied
(denoted <em class="replaceable"><code>N</code></em> below).</p></dd>
<dt><span class="term"> Int16[<em class="replaceable"><code>N</code></em>]</span></dt>
<dd><p> The format codes to be used for each column.
Each must presently be zero (text) or one (binary).
All must be zero if the overall copy format is textual.</p></dd>
</dl></div>
<p>
</p>
</dd>
<dt><span class="term">DataRow (B)</span></dt>
<dd>
<div class="variablelist"><dl>
<dt><span class="term"> Byte1('D')</span></dt>
<dd><p> Identifies the message as a data row.</p></dd>
<dt><span class="term"> Int32</span></dt>
<dd><p> Length of message contents in bytes, including self.</p></dd>
<dt><span class="term"> Int16</span></dt>
<dd><p> The number of column values that follow (possibly zero).</p></dd>
</dl></div>
<p>
Next, the following pair of fields appear for each column:
</p>
<div class="variablelist"><dl>
<dt><span class="term"> Int32</span></dt>
<dd><p> The length of the column value, in bytes (this count
does not include itself). Can be zero.
As a special case, -1 indicates a NULL column value.
No value bytes follow in the NULL case.</p></dd>
<dt><span class="term"> Byte<em class="replaceable"><code>n</code></em></span></dt>
<dd><p> The value of the column, in the format indicated by the
associated format code.
<em class="replaceable"><code>n</code></em> is the above length.</p></dd>
</dl></div>
<p>
</p>
</dd>
<dt><span class="term">Describe (F)</span></dt>
<dd>
<p>
</p>
<div class="variablelist"><dl>
<dt><span class="term"> Byte1('D')</span></dt>
<dd><p> Identifies the message as a Describe command.</p></dd>
<dt><span class="term"> Int32</span></dt>
<dd><p> Length of message contents in bytes, including self.</p></dd>
<dt><span class="term"> Byte1</span></dt>
<dd><p> '<code class="literal">S</code>' to describe a prepared statement; or
'<code class="literal">P</code>' to describe a portal.</p></dd>
<dt><span class="term"> String</span></dt>
<dd><p> The name of the prepared statement or portal to describe
(an empty string selects the unnamed prepared statement
or portal).</p></dd>
</dl></div>
</dd>
<dt><span class="term">EmptyQueryResponse (B)</span></dt>
<dd>
<p>
</p>
<div class="variablelist"><dl>
<dt><span class="term"> Byte1('I')</span></dt>
<dd><p> Identifies the message as a response to an empty query string.
(This substitutes for CommandComplete.)</p></dd>
<dt><span class="term"> Int32(4)</span></dt>
<dd><p> Length of message contents in bytes, including self.</p></dd>
</dl></div>
<p>
</p>
</dd>
<dt><span class="term">ErrorResponse (B)</span></dt>
<dd>
<p>
</p>
<div class="variablelist"><dl>
<dt><span class="term"> Byte1('E')</span></dt>
<dd><p> Identifies the message as an error.</p></dd>
<dt><span class="term"> Int32</span></dt>
<dd><p> Length of message contents in bytes, including self.</p></dd>
</dl></div>
<p>
The message body consists of one or more identified fields,
followed by a zero byte as a terminator. Fields may appear in
any order. For each field there is the following:
</p>
<div class="variablelist"><dl>
<dt><span class="term"> Byte1</span></dt>
<dd><p> A code identifying the field type; if zero, this is
the message terminator and no string follows.
The presently defined field types are listed in
<a href="protocol-error-fields.html" title="43.5.Error and Notice Message Fields">Section43.5, “Error and Notice Message Fields”</a>.
Since more field types may be added in future,
frontends should silently ignore fields of unrecognized
type.</p></dd>
<dt><span class="term"> String</span></dt>
<dd><p> The field value.</p></dd>
</dl></div>
<p>
</p>
</dd>
<dt><span class="term">Execute (F)</span></dt>
<dd>
<p>
</p>
<div class="variablelist"><dl>
<dt><span class="term"> Byte1('E')</span></dt>
<dd><p> Identifies the message as an Execute command.</p></dd>
<dt><span class="term"> Int32</span></dt>
<dd><p> Length of message contents in bytes, including self.</p></dd>
<dt><span class="term"> String</span></dt>
<dd><p> The name of the portal to execute
(an empty string selects the unnamed portal).</p></dd>
<dt><span class="term"> Int32</span></dt>
<dd><p> Maximum number of rows to return, if portal contains
a query that returns rows (ignored otherwise). Zero
denotes “<span class="quote">no limit</span>”.</p></dd>
</dl></div>
</dd>
<dt><span class="term">Flush (F)</span></dt>
<dd>
<p>
</p>
<div class="variablelist"><dl>
<dt><span class="term"> Byte1('H')</span></dt>
<dd><p> Identifies the message as a Flush command.</p></dd>
<dt><span class="term"> Int32(4)</span></dt>
<dd><p> Length of message contents in bytes, including self.</p></dd>
</dl></div>
<p>
</p>
</dd>
<dt><span class="term">FunctionCall (F)</span></dt>
<dd>
<p>
</p>
<div class="variablelist"><dl>
<dt><span class="term"> Byte1('F')</span></dt>
<dd><p> Identifies the message as a function call.</p></dd>
<dt><span class="term"> Int32</span></dt>
<dd><p> Length of message contents in bytes, including self.</p></dd>
<dt><span class="term"> Int32</span></dt>
<dd><p> Specifies the object ID of the function to call.</p></dd>
<dt><span class="term"> Int16</span></dt>
<dd><p> The number of argument format codes that follow
(denoted <em class="replaceable"><code>C</code></em> below).
This can be zero to indicate that there are no arguments
or that the arguments all use the default format (text);
or one, in which case the specified format code is applied
to all arguments; or it can equal the actual number of
arguments.</p></dd>
<dt><span class="term"> Int16[<em class="replaceable"><code>C</code></em>]</span></dt>
<dd><p> The argument format codes. Each must presently be
zero (text) or one (binary).</p></dd>
<dt><span class="term"> Int16</span></dt>
<dd><p> Specifies the number of arguments being supplied to the
function.</p></dd>
</dl></div>
<p>
Next, the following pair of fields appear for each argument:
</p>
<div class="variablelist"><dl>
<dt><span class="term"> Int32</span></dt>
<dd><p> The length of the argument value, in bytes (this count
does not include itself). Can be zero.
As a special case, -1 indicates a NULL argument value.
No value bytes follow in the NULL case.</p></dd>
<dt><span class="term"> Byte<em class="replaceable"><code>n</code></em></span></dt>
<dd><p> The value of the argument, in the format indicated by the
associated format code.
<em class="replaceable"><code>n</code></em> is the above length.</p></dd>
</dl></div>
<p>
After the last argument, the following field appears:
</p>
<div class="variablelist"><dl>
<dt><span class="term"> Int16</span></dt>
<dd><p> The format code for the function result. Must presently be
zero (text) or one (binary).</p></dd>
</dl></div>
<p>
</p>
</dd>
<dt><span class="term">FunctionCallResponse (B)</span></dt>
<dd>
<p>
</p>
<div class="variablelist"><dl>
<dt><span class="term"> Byte1('V')</span></dt>
<dd><p> Identifies the message as a function call result.</p></dd>
<dt><span class="term"> Int32</span></dt>
<dd><p> Length of message contents in bytes, including self.</p></dd>
<dt><span class="term"> Int32</span></dt>
<dd><p> The length of the function result value, in bytes (this count
does not include itself). Can be zero.
As a special case, -1 indicates a NULL function result.
No value bytes follow in the NULL case.</p></dd>
<dt><span class="term"> Byte<em class="replaceable"><code>n</code></em></span></dt>
<dd><p> The value of the function result, in the format indicated by
the associated format code.
<em class="replaceable"><code>n</code></em> is the above length.</p></dd>
</dl></div>
<p>
</p>
</dd>
<dt><span class="term">NoData (B)</span></dt>
<dd>
<p>
</p>
<div class="variablelist"><dl>
<dt><span class="term"> Byte1('n')</span></dt>
<dd><p> Identifies the message as a no-data indicator.</p></dd>
<dt><span class="term"> Int32(4)</span></dt>
<dd><p> Length of message contents in bytes, including self.</p></dd>
</dl></div>
<p>
</p>
</dd>
<dt><span class="term">NoticeResponse (B)</span></dt>
<dd>
<p>
</p>
<div class="variablelist"><dl>
<dt><span class="term"> Byte1('N')</span></dt>
<dd><p> Identifies the message as a notice.</p></dd>
<dt><span class="term"> Int32</span></dt>
<dd><p> Length of message contents in bytes, including self.</p></dd>
</dl></div>
<p>
The message body consists of one or more identified fields,
followed by a zero byte as a terminator. Fields may appear in
any order. For each field there is the following:
</p>
<div class="variablelist"><dl>
<dt><span class="term"> Byte1</span></dt>
<dd><p> A code identifying the field type; if zero, this is
the message terminator and no string follows.
The presently defined field types are listed in
<a href="protocol-error-fields.html" title="43.5.Error and Notice Message Fields">Section43.5, “Error and Notice Message Fields”</a>.
Since more field types may be added in future,
frontends should silently ignore fields of unrecognized
type.</p></dd>
<dt><span class="term"> String</span></dt>
<dd><p> The field value.</p></dd>
</dl></div>
<p>
</p>
</dd>
<dt><span class="term">NotificationResponse (B)</span></dt>
<dd>
<p>
</p>
<div class="variablelist"><dl>
<dt><span class="term"> Byte1('A')</span></dt>
<dd><p> Identifies the message as a notification response.</p></dd>
<dt><span class="term"> Int32</span></dt>
<dd><p> Length of message contents in bytes, including self.</p></dd>
<dt><span class="term"> Int32</span></dt>
<dd><p> The process ID of the notifying backend process.</p></dd>
<dt><span class="term"> String</span></dt>
<dd><p> The name of the condition that the notify has been raised on.</p></dd>
<dt><span class="term"> String</span></dt>
<dd><p> Additional information passed from the notifying process.
(Currently, this feature is unimplemented so the field
is always an empty string.)</p></dd>
</dl></div>
<p>
</p>
</dd>
<dt><span class="term">ParameterDescription (B)</span></dt>
<dd>
<p>
</p>
<div class="variablelist"><dl>
<dt><span class="term"> Byte1('t')</span></dt>
<dd><p> Identifies the message as a parameter description.</p></dd>
<dt><span class="term"> Int32</span></dt>
<dd><p> Length of message contents in bytes, including self.</p></dd>
<dt><span class="term"> Int16</span></dt>
<dd><p> The number of parameters used by the statement
(may be zero).</p></dd>
</dl></div>
<p>
Then, for each parameter, there is the following:
</p>
<div class="variablelist"><dl>
<dt><span class="term"> Int32</span></dt>
<dd><p> Specifies the object ID of the parameter data type.</p></dd>
</dl></div>
</dd>
<dt><span class="term">ParameterStatus (B)</span></dt>
<dd>
<p>
</p>
<div class="variablelist"><dl>
<dt><span class="term"> Byte1('S')</span></dt>
<dd><p> Identifies the message as a run-time parameter status report.</p></dd>
<dt><span class="term"> Int32</span></dt>
<dd><p> Length of message contents in bytes, including self.</p></dd>
<dt><span class="term"> String</span></dt>
<dd><p> The name of the run-time parameter being reported.</p></dd>
<dt><span class="term"> String</span></dt>
<dd><p> The current value of the parameter.</p></dd>
</dl></div>
</dd>
<dt><span class="term">Parse (F)</span></dt>
<dd>
<p>
</p>
<div class="variablelist"><dl>
<dt><span class="term"> Byte1('P')</span></dt>
<dd><p> Identifies the message as a Parse command.</p></dd>
<dt><span class="term"> Int32</span></dt>
<dd><p> Length of message contents in bytes, including self.</p></dd>
<dt><span class="term"> String</span></dt>
<dd><p> The name of the destination prepared statement
(an empty string selects the unnamed prepared statement).</p></dd>
<dt><span class="term"> String</span></dt>
<dd><p> The query string to be parsed.</p></dd>
<dt><span class="term"> Int16</span></dt>
<dd><p> The number of parameter data types specified
(may be zero). Note that this is not an indication of
the number of parameters that might appear in the
query string, only the number that the frontend wants to
prespecify types for.</p></dd>
</dl></div>
<p>
Then, for each parameter, there is the following:
</p>
<div class="variablelist"><dl>
<dt><span class="term"> Int32</span></dt>
<dd><p> Specifies the object ID of the parameter data type.
Placing a zero here is equivalent to leaving the type
unspecified.</p></dd>
</dl></div>
</dd>
<dt><span class="term">ParseComplete (B)</span></dt>
<dd>
<p>
</p>
<div class="variablelist"><dl>
<dt><span class="term"> Byte1('1')</span></dt>
<dd><p> Identifies the message as a Parse-complete indicator.</p></dd>
<dt><span class="term"> Int32(4)</span></dt>
<dd><p> Length of message contents in bytes, including self.</p></dd>
</dl></div>
<p>
</p>
</dd>
<dt><span class="term">PasswordMessage (F)</span></dt>
<dd>
<p>
</p>
<div class="variablelist"><dl>
<dt><span class="term"> Byte1('p')</span></dt>
<dd><p> Identifies the message as a password response.</p></dd>
<dt><span class="term"> Int32</span></dt>
<dd><p> Length of message contents in bytes, including self.</p></dd>
<dt><span class="term"> String</span></dt>
<dd><p> The password (encrypted, if requested).</p></dd>
</dl></div>
</dd>
<dt><span class="term">PortalSuspended (B)</span></dt>
<dd>
<p>
</p>
<div class="variablelist"><dl>
<dt><span class="term"> Byte1('s')</span></dt>
<dd><p> Identifies the message as a portal-suspended indicator.
Note this only appears if an Execute message's row-count limit
was reached.</p></dd>
<dt><span class="term"> Int32(4)</span></dt>
<dd><p> Length of message contents in bytes, including self.</p></dd>
</dl></div>
<p>
</p>
</dd>
<dt><span class="term">Query (F)</span></dt>
<dd>
<p>
</p>
<div class="variablelist"><dl>
<dt><span class="term"> Byte1('Q')</span></dt>
<dd><p> Identifies the message as a simple query.</p></dd>
<dt><span class="term"> Int32</span></dt>
<dd><p> Length of message contents in bytes, including self.</p></dd>
<dt><span class="term"> String</span></dt>
<dd><p> The query string itself.</p></dd>
</dl></div>
<p>
</p>
</dd>
<dt><span class="term">ReadyForQuery (B)</span></dt>
<dd>
<p>
</p>
<div class="variablelist"><dl>
<dt><span class="term"> Byte1('Z')</span></dt>
<dd><p> Identifies the message type. ReadyForQuery is sent
whenever the backend is ready for a new query cycle.</p></dd>
<dt><span class="term"> Int32(5)</span></dt>
<dd><p> Length of message contents in bytes, including self.</p></dd>
<dt><span class="term"> Byte1</span></dt>
<dd><p> Current backend transaction status indicator.
Possible values are '<code class="literal">I</code>' if idle (not in
a transaction block); '<code class="literal">T</code>' if in a transaction
block; or '<code class="literal">E</code>' if in a failed transaction
block (queries will be rejected until block is ended).</p></dd>
</dl></div>
<p>
</p>
</dd>
<dt><span class="term">RowDescription (B)</span></dt>
<dd>
<p>
</p>
<div class="variablelist"><dl>
<dt><span class="term"> Byte1('T')</span></dt>
<dd><p> Identifies the message as a row description.</p></dd>
<dt><span class="term"> Int32</span></dt>
<dd><p> Length of message contents in bytes, including self.</p></dd>
<dt><span class="term"> Int16</span></dt>
<dd><p> Specifies the number of fields in a row (may be zero).</p></dd>
</dl></div>
<p>
Then, for each field, there is the following:
</p>
<div class="variablelist"><dl>
<dt><span class="term"> String</span></dt>
<dd><p> The field name.</p></dd>
<dt><span class="term"> Int32</span></dt>
<dd><p> If the field can be identified as a column of a specific
table, the object ID of the table; otherwise zero.</p></dd>
<dt><span class="term"> Int16</span></dt>
<dd><p> If the field can be identified as a column of a specific
table, the attribute number of the column; otherwise zero.</p></dd>
<dt><span class="term"> Int32</span></dt>
<dd><p> The object ID of the field's data type.</p></dd>
<dt><span class="term"> Int16</span></dt>
<dd><p> The data type size (see <code class="varname">pg_type.typlen</code>).
Note that negative values denote variable-width types.</p></dd>
<dt><span class="term"> Int32</span></dt>
<dd><p> The type modifier (see <code class="varname">pg_attribute.atttypmod</code>).
The meaning of the modifier is type-specific.</p></dd>
<dt><span class="term"> Int16</span></dt>
<dd><p> The format code being used for the field. Currently will
be zero (text) or one (binary). In a RowDescription
returned from the statement variant of Describe, the
format code is not yet known and will always be zero.</p></dd>
</dl></div>
<p>
</p>
</dd>
<dt><span class="term">SSLRequest (F)</span></dt>
<dd>
<p>
</p>
<div class="variablelist"><dl>
<dt><span class="term"> Int32(8)</span></dt>
<dd><p> Length of message contents in bytes, including self.</p></dd>
<dt><span class="term"> Int32(80877103)</span></dt>
<dd><p> The <acronym class="acronym">SSL</acronym> request code. The value is chosen to contain
<code class="literal">1234</code> in the most significant 16 bits, and <code class="literal">5679</code> in the
least 16 significant bits. (To avoid confusion, this code
must not be the same as any protocol version number.)</p></dd>
</dl></div>
<p>
</p>
</dd>
<dt><span class="term">StartupMessage (F)</span></dt>
<dd>
<p>
</p>
<div class="variablelist"><dl>
<dt><span class="term"> Int32</span></dt>
<dd><p> Length of message contents in bytes, including self.</p></dd>
<dt><span class="term"> Int32(196608)</span></dt>
<dd><p> The protocol version number. The most significant 16 bits are
the major version number (3 for the protocol described here).
The least significant 16 bits are the minor version number
(0 for the protocol described here).</p></dd>
</dl></div>
<p>
The protocol version number is followed by one or more pairs of
parameter name and value strings. A zero byte is required as a
terminator after the last name/value pair.
Parameters can appear in any
order. <code class="literal">user</code> is required, others are optional.
Each parameter is specified as:
</p>
<div class="variablelist"><dl>
<dt><span class="term"> String</span></dt>
<dd>
<p> The parameter name. Currently recognized names are:
</p>
<div class="variablelist"><dl>
<dt><span class="term"> <code class="literal">user</code></span></dt>
<dd><p> The database user name to connect as. Required;
there is no default.</p></dd>
<dt><span class="term"> <code class="literal">database</code></span></dt>
<dd><p> The database to connect to. Defaults to the user name.</p></dd>
<dt><span class="term"> <code class="literal">options</code></span></dt>
<dd><p> Command-line arguments for the backend. (This is
deprecated in favor of setting individual run-time
parameters.)</p></dd>
</dl></div>
<p>
In addition to the above, any run-time parameter that can be
set at backend start time may be listed. Such settings
will be applied during backend start (after parsing the
command-line options if any). The values will act as
session defaults.</p>
</dd>
<dt><span class="term"> String</span></dt>
<dd><p> The parameter value.</p></dd>
</dl></div>
<p>
</p>
</dd>
<dt><span class="term">Sync (F)</span></dt>
<dd>
<p>
</p>
<div class="variablelist"><dl>
<dt><span class="term"> Byte1('S')</span></dt>
<dd><p> Identifies the message as a Sync command.</p></dd>
<dt><span class="term"> Int32(4)</span></dt>
<dd><p> Length of message contents in bytes, including self.</p></dd>
</dl></div>
<p>
</p>
</dd>
<dt><span class="term">Terminate (F)</span></dt>
<dd>
<p>
</p>
<div class="variablelist"><dl>
<dt><span class="term"> Byte1('X')</span></dt>
<dd><p> Identifies the message as a termination.</p></dd>
<dt><span class="term"> Int32(4)</span></dt>
<dd><p> Length of message contents in bytes, including self.</p></dd>
</dl></div>
<p>
</p>
</dd>
</dl></div>
</div></body>
</html>
|