~ubuntu-branches/ubuntu/oneiric/postgresql-9.1/oneiric-security

« back to all changes in this revision

Viewing changes to doc/src/sgml/html/protocol-message-formats.html

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2011-05-11 10:41:53 UTC
  • Revision ID: james.westby@ubuntu.com-20110511104153-psbh2o58553fv1m0
Tags: upstream-9.1~beta1
ImportĀ upstreamĀ versionĀ 9.1~beta1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 
2
<HTML
 
3
><HEAD
 
4
><TITLE
 
5
>Message Formats</TITLE
 
6
><META
 
7
NAME="GENERATOR"
 
8
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
 
9
REV="MADE"
 
10
HREF="mailto:pgsql-docs@postgresql.org"><LINK
 
11
REL="HOME"
 
12
TITLE="PostgreSQL 9.1beta1 Documentation"
 
13
HREF="index.html"><LINK
 
14
REL="UP"
 
15
TITLE="Frontend/Backend Protocol"
 
16
HREF="protocol.html"><LINK
 
17
REL="PREVIOUS"
 
18
TITLE="Message Data Types"
 
19
HREF="protocol-message-types.html"><LINK
 
20
REL="NEXT"
 
21
TITLE="Error and Notice Message Fields"
 
22
HREF="protocol-error-fields.html"><LINK
 
23
REL="STYLESHEET"
 
24
TYPE="text/css"
 
25
HREF="stylesheet.css"><META
 
26
HTTP-EQUIV="Content-Type"
 
27
CONTENT="text/html; charset=ISO-8859-1"><META
 
28
NAME="creation"
 
29
CONTENT="2011-04-27T21:20:33"></HEAD
 
30
><BODY
 
31
CLASS="SECT1"
 
32
><DIV
 
33
CLASS="NAVHEADER"
 
34
><TABLE
 
35
SUMMARY="Header navigation table"
 
36
WIDTH="100%"
 
37
BORDER="0"
 
38
CELLPADDING="0"
 
39
CELLSPACING="0"
 
40
><TR
 
41
><TH
 
42
COLSPAN="5"
 
43
ALIGN="center"
 
44
VALIGN="bottom"
 
45
><A
 
46
HREF="index.html"
 
47
>PostgreSQL 9.1beta1 Documentation</A
 
48
></TH
 
49
></TR
 
50
><TR
 
51
><TD
 
52
WIDTH="10%"
 
53
ALIGN="left"
 
54
VALIGN="top"
 
55
><A
 
56
TITLE="Message Data Types"
 
57
HREF="protocol-message-types.html"
 
58
ACCESSKEY="P"
 
59
>Prev</A
 
60
></TD
 
61
><TD
 
62
WIDTH="10%"
 
63
ALIGN="left"
 
64
VALIGN="top"
 
65
><A
 
66
TITLE="Frontend/Backend Protocol"
 
67
HREF="protocol.html"
 
68
>Fast Backward</A
 
69
></TD
 
70
><TD
 
71
WIDTH="60%"
 
72
ALIGN="center"
 
73
VALIGN="bottom"
 
74
>Chapter 46. Frontend/Backend Protocol</TD
 
75
><TD
 
76
WIDTH="10%"
 
77
ALIGN="right"
 
78
VALIGN="top"
 
79
><A
 
80
TITLE="Frontend/Backend Protocol"
 
81
HREF="protocol.html"
 
82
>Fast Forward</A
 
83
></TD
 
84
><TD
 
85
WIDTH="10%"
 
86
ALIGN="right"
 
87
VALIGN="top"
 
88
><A
 
89
TITLE="Error and Notice Message Fields"
 
90
HREF="protocol-error-fields.html"
 
91
ACCESSKEY="N"
 
92
>Next</A
 
93
></TD
 
94
></TR
 
95
></TABLE
 
96
><HR
 
97
ALIGN="LEFT"
 
98
WIDTH="100%"></DIV
 
99
><DIV
 
100
CLASS="SECT1"
 
101
><H1
 
102
CLASS="SECT1"
 
103
><A
 
104
NAME="PROTOCOL-MESSAGE-FORMATS"
 
105
>46.5. Message Formats</A
 
106
></H1
 
107
><P
 
108
>This section describes the detailed format of each message.  Each is marked to
 
109
indicate that it can be sent by a frontend (F), a backend (B), or both
 
110
(F &amp; B).
 
111
Notice that although each message includes a byte count at the beginning,
 
112
the message format is defined so that the message end can be found without
 
113
reference to the byte count.  This aids validity checking.  (The CopyData
 
114
message is an exception, because it forms part of a data stream; the contents
 
115
of any individual CopyData message cannot be interpretable on their own.)</P
 
116
><P
 
117
></P
 
118
><DIV
 
119
CLASS="VARIABLELIST"
 
120
><DL
 
121
><DT
 
122
>AuthenticationOk (B)</DT
 
123
><DD
 
124
><P
 
125
>&#13;<P
 
126
></P
 
127
></P><DIV
 
128
CLASS="VARIABLELIST"
 
129
><DL
 
130
><DT
 
131
>Byte1('R')</DT
 
132
><DD
 
133
><P
 
134
>                Identifies the message as an authentication request.</P
 
135
></DD
 
136
><DT
 
137
>Int32(8)</DT
 
138
><DD
 
139
><P
 
140
>                Length of message contents in bytes, including self.</P
 
141
></DD
 
142
><DT
 
143
>Int32(0)</DT
 
144
><DD
 
145
><P
 
146
>                Specifies that the authentication was successful.</P
 
147
></DD
 
148
></DL
 
149
></DIV
 
150
><P>&#13;</P
 
151
></DD
 
152
><DT
 
153
>AuthenticationKerberosV5 (B)</DT
 
154
><DD
 
155
><P
 
156
>&#13;<P
 
157
></P
 
158
></P><DIV
 
159
CLASS="VARIABLELIST"
 
160
><DL
 
161
><DT
 
162
>Byte1('R')</DT
 
163
><DD
 
164
><P
 
165
>                Identifies the message as an authentication request.</P
 
166
></DD
 
167
><DT
 
168
>Int32(8)</DT
 
169
><DD
 
170
><P
 
171
>                Length of message contents in bytes, including self.</P
 
172
></DD
 
173
><DT
 
174
>Int32(2)</DT
 
175
><DD
 
176
><P
 
177
>                Specifies that Kerberos V5 authentication is required.</P
 
178
></DD
 
179
></DL
 
180
></DIV
 
181
><P></P
 
182
></DD
 
183
><DT
 
184
>AuthenticationCleartextPassword (B)</DT
 
185
><DD
 
186
><P
 
187
>&#13;<P
 
188
></P
 
189
></P><DIV
 
190
CLASS="VARIABLELIST"
 
191
><DL
 
192
><DT
 
193
>Byte1('R')</DT
 
194
><DD
 
195
><P
 
196
>                Identifies the message as an authentication request.</P
 
197
></DD
 
198
><DT
 
199
>Int32(8)</DT
 
200
><DD
 
201
><P
 
202
>                Length of message contents in bytes, including self.</P
 
203
></DD
 
204
><DT
 
205
>Int32(3)</DT
 
206
><DD
 
207
><P
 
208
>                Specifies that a clear-text password is required.</P
 
209
></DD
 
210
></DL
 
211
></DIV
 
212
><P></P
 
213
></DD
 
214
><DT
 
215
>AuthenticationMD5Password (B)</DT
 
216
><DD
 
217
><P
 
218
>&#13;<P
 
219
></P
 
220
></P><DIV
 
221
CLASS="VARIABLELIST"
 
222
><DL
 
223
><DT
 
224
>Byte1('R')</DT
 
225
><DD
 
226
><P
 
227
>                Identifies the message as an authentication request.</P
 
228
></DD
 
229
><DT
 
230
>Int32(12)</DT
 
231
><DD
 
232
><P
 
233
>                Length of message contents in bytes, including self.</P
 
234
></DD
 
235
><DT
 
236
>Int32(5)</DT
 
237
><DD
 
238
><P
 
239
>                Specifies that an MD5-encrypted password is required.</P
 
240
></DD
 
241
><DT
 
242
>Byte4</DT
 
243
><DD
 
244
><P
 
245
>                The salt to use when encrypting the password.</P
 
246
></DD
 
247
></DL
 
248
></DIV
 
249
><P>&#13;</P
 
250
></DD
 
251
><DT
 
252
>AuthenticationSCMCredential (B)</DT
 
253
><DD
 
254
><P
 
255
>&#13;<P
 
256
></P
 
257
></P><DIV
 
258
CLASS="VARIABLELIST"
 
259
><DL
 
260
><DT
 
261
>Byte1('R')</DT
 
262
><DD
 
263
><P
 
264
>                Identifies the message as an authentication request.</P
 
265
></DD
 
266
><DT
 
267
>Int32(8)</DT
 
268
><DD
 
269
><P
 
270
>                Length of message contents in bytes, including self.</P
 
271
></DD
 
272
><DT
 
273
>Int32(6)</DT
 
274
><DD
 
275
><P
 
276
>                Specifies that an SCM credentials message is required.</P
 
277
></DD
 
278
></DL
 
279
></DIV
 
280
><P>&#13;</P
 
281
></DD
 
282
><DT
 
283
>AuthenticationGSS (B)</DT
 
284
><DD
 
285
><P
 
286
>&#13;<P
 
287
></P
 
288
></P><DIV
 
289
CLASS="VARIABLELIST"
 
290
><DL
 
291
><DT
 
292
>Byte1('R')</DT
 
293
><DD
 
294
><P
 
295
>                Identifies the message as an authentication request.</P
 
296
></DD
 
297
><DT
 
298
>Int32(8)</DT
 
299
><DD
 
300
><P
 
301
>                Length of message contents in bytes, including self.</P
 
302
></DD
 
303
><DT
 
304
>Int32(7)</DT
 
305
><DD
 
306
><P
 
307
>                Specifies that GSSAPI authentication is required.</P
 
308
></DD
 
309
></DL
 
310
></DIV
 
311
><P>&#13;</P
 
312
></DD
 
313
><DT
 
314
>AuthenticationSSPI (B)</DT
 
315
><DD
 
316
><P
 
317
>&#13;<P
 
318
></P
 
319
></P><DIV
 
320
CLASS="VARIABLELIST"
 
321
><DL
 
322
><DT
 
323
>Byte1('R')</DT
 
324
><DD
 
325
><P
 
326
>                Identifies the message as an authentication request.</P
 
327
></DD
 
328
><DT
 
329
>Int32(8)</DT
 
330
><DD
 
331
><P
 
332
>                Length of message contents in bytes, including self.</P
 
333
></DD
 
334
><DT
 
335
>Int32(9)</DT
 
336
><DD
 
337
><P
 
338
>                Specifies that SSPI authentication is required.</P
 
339
></DD
 
340
></DL
 
341
></DIV
 
342
><P>&#13;</P
 
343
></DD
 
344
><DT
 
345
>AuthenticationGSSContinue (B)</DT
 
346
><DD
 
347
><P
 
348
>&#13;<P
 
349
></P
 
350
></P><DIV
 
351
CLASS="VARIABLELIST"
 
352
><DL
 
353
><DT
 
354
>Byte1('R')</DT
 
355
><DD
 
356
><P
 
357
>                Identifies the message as an authentication request.</P
 
358
></DD
 
359
><DT
 
360
>Int32</DT
 
361
><DD
 
362
><P
 
363
>                Length of message contents in bytes, including self.</P
 
364
></DD
 
365
><DT
 
366
>Int32(8)</DT
 
367
><DD
 
368
><P
 
369
>                Specifies that this message contains GSSAPI or SSPI data.</P
 
370
></DD
 
371
><DT
 
372
>Byte<TT
 
373
CLASS="REPLACEABLE"
 
374
><I
 
375
>n</I
 
376
></TT
 
377
></DT
 
378
><DD
 
379
><P
 
380
>                GSSAPI or SSPI authentication data.</P
 
381
></DD
 
382
></DL
 
383
></DIV
 
384
><P>&#13;</P
 
385
></DD
 
386
><DT
 
387
>BackendKeyData (B)</DT
 
388
><DD
 
389
><P
 
390
>&#13;<P
 
391
></P
 
392
></P><DIV
 
393
CLASS="VARIABLELIST"
 
394
><DL
 
395
><DT
 
396
>Byte1('K')</DT
 
397
><DD
 
398
><P
 
399
>                Identifies the message as cancellation key data.
 
400
                The frontend must save these values if it wishes to be
 
401
                able to issue CancelRequest messages later.</P
 
402
></DD
 
403
><DT
 
404
>Int32(12)</DT
 
405
><DD
 
406
><P
 
407
>                Length of message contents in bytes, including self.</P
 
408
></DD
 
409
><DT
 
410
>Int32</DT
 
411
><DD
 
412
><P
 
413
>                The process ID of this backend.</P
 
414
></DD
 
415
><DT
 
416
>Int32</DT
 
417
><DD
 
418
><P
 
419
>                The secret key of this backend.</P
 
420
></DD
 
421
></DL
 
422
></DIV
 
423
><P>&#13;</P
 
424
></DD
 
425
><DT
 
426
>Bind (F)</DT
 
427
><DD
 
428
><P
 
429
>&#13;<P
 
430
></P
 
431
></P><DIV
 
432
CLASS="VARIABLELIST"
 
433
><DL
 
434
><DT
 
435
>Byte1('B')</DT
 
436
><DD
 
437
><P
 
438
>                Identifies the message as a Bind command.</P
 
439
></DD
 
440
><DT
 
441
>Int32</DT
 
442
><DD
 
443
><P
 
444
>                Length of message contents in bytes, including self.</P
 
445
></DD
 
446
><DT
 
447
>String</DT
 
448
><DD
 
449
><P
 
450
>                The name of the destination portal
 
451
                (an empty string selects the unnamed portal).</P
 
452
></DD
 
453
><DT
 
454
>String</DT
 
455
><DD
 
456
><P
 
457
>                The name of the source prepared statement
 
458
                (an empty string selects the unnamed prepared statement).</P
 
459
></DD
 
460
><DT
 
461
>Int16</DT
 
462
><DD
 
463
><P
 
464
>                The number of parameter format codes that follow
 
465
                (denoted <TT
 
466
CLASS="REPLACEABLE"
 
467
><I
 
468
>C</I
 
469
></TT
 
470
> below).
 
471
                This can be zero to indicate that there are no parameters
 
472
                or that the parameters all use the default format (text);
 
473
                or one, in which case the specified format code is applied
 
474
                to all parameters; or it can equal the actual number of
 
475
                parameters.</P
 
476
></DD
 
477
><DT
 
478
>Int16[<TT
 
479
CLASS="REPLACEABLE"
 
480
><I
 
481
>C</I
 
482
></TT
 
483
>]</DT
 
484
><DD
 
485
><P
 
486
>                The parameter format codes.  Each must presently be
 
487
                zero (text) or one (binary).</P
 
488
></DD
 
489
><DT
 
490
>Int16</DT
 
491
><DD
 
492
><P
 
493
>                The number of parameter values that follow (possibly zero).
 
494
                This must match the number of parameters needed by the query.</P
 
495
></DD
 
496
></DL
 
497
></DIV
 
498
><P>
 
499
        Next, the following pair of fields appear for each parameter:
 
500
<P
 
501
></P
 
502
></P><DIV
 
503
CLASS="VARIABLELIST"
 
504
><DL
 
505
><DT
 
506
>Int32</DT
 
507
><DD
 
508
><P
 
509
>                The length of the parameter value, in bytes (this count
 
510
                does not include itself).  Can be zero.
 
511
                As a special case, -1 indicates a NULL parameter value.
 
512
                No value bytes follow in the NULL case.</P
 
513
></DD
 
514
><DT
 
515
>Byte<TT
 
516
CLASS="REPLACEABLE"
 
517
><I
 
518
>n</I
 
519
></TT
 
520
></DT
 
521
><DD
 
522
><P
 
523
>                The value of the parameter, in the format indicated by the
 
524
                associated format code.
 
525
                <TT
 
526
CLASS="REPLACEABLE"
 
527
><I
 
528
>n</I
 
529
></TT
 
530
> is the above length.</P
 
531
></DD
 
532
></DL
 
533
></DIV
 
534
><P>
 
535
        After the last parameter, the following fields appear:
 
536
<P
 
537
></P
 
538
></P><DIV
 
539
CLASS="VARIABLELIST"
 
540
><DL
 
541
><DT
 
542
>Int16</DT
 
543
><DD
 
544
><P
 
545
>                The number of result-column format codes that follow
 
546
                (denoted <TT
 
547
CLASS="REPLACEABLE"
 
548
><I
 
549
>R</I
 
550
></TT
 
551
> below).
 
552
                This can be zero to indicate that there are no result columns
 
553
                or that the result columns should all use the default format
 
554
                (text);
 
555
                or one, in which case the specified format code is applied
 
556
                to all result columns (if any); or it can equal the actual
 
557
                number of result columns of the query.</P
 
558
></DD
 
559
><DT
 
560
>Int16[<TT
 
561
CLASS="REPLACEABLE"
 
562
><I
 
563
>R</I
 
564
></TT
 
565
>]</DT
 
566
><DD
 
567
><P
 
568
>                The result-column format codes.  Each must presently be
 
569
                zero (text) or one (binary).</P
 
570
></DD
 
571
></DL
 
572
></DIV
 
573
><P></P
 
574
></DD
 
575
><DT
 
576
>BindComplete (B)</DT
 
577
><DD
 
578
><P
 
579
>&#13;<P
 
580
></P
 
581
></P><DIV
 
582
CLASS="VARIABLELIST"
 
583
><DL
 
584
><DT
 
585
>Byte1('2')</DT
 
586
><DD
 
587
><P
 
588
>                Identifies the message as a Bind-complete indicator.</P
 
589
></DD
 
590
><DT
 
591
>Int32(4)</DT
 
592
><DD
 
593
><P
 
594
>                Length of message contents in bytes, including self.</P
 
595
></DD
 
596
></DL
 
597
></DIV
 
598
><P>&#13;</P
 
599
></DD
 
600
><DT
 
601
>CancelRequest (F)</DT
 
602
><DD
 
603
><P
 
604
>&#13;<P
 
605
></P
 
606
></P><DIV
 
607
CLASS="VARIABLELIST"
 
608
><DL
 
609
><DT
 
610
>Int32(16)</DT
 
611
><DD
 
612
><P
 
613
>                Length of message contents in bytes, including self.</P
 
614
></DD
 
615
><DT
 
616
>Int32(80877102)</DT
 
617
><DD
 
618
><P
 
619
>                The cancel request code.  The value is chosen to contain
 
620
                <TT
 
621
CLASS="LITERAL"
 
622
>1234</TT
 
623
> in the most significant 16 bits, and <TT
 
624
CLASS="LITERAL"
 
625
>5678</TT
 
626
> in the
 
627
                least 16 significant bits.  (To avoid confusion, this code
 
628
                must not be the same as any protocol version number.)</P
 
629
></DD
 
630
><DT
 
631
>Int32</DT
 
632
><DD
 
633
><P
 
634
>                The process ID of the target backend.</P
 
635
></DD
 
636
><DT
 
637
>Int32</DT
 
638
><DD
 
639
><P
 
640
>                The secret key for the target backend.</P
 
641
></DD
 
642
></DL
 
643
></DIV
 
644
><P>&#13;</P
 
645
></DD
 
646
><DT
 
647
>Close (F)</DT
 
648
><DD
 
649
><P
 
650
>&#13;<P
 
651
></P
 
652
></P><DIV
 
653
CLASS="VARIABLELIST"
 
654
><DL
 
655
><DT
 
656
>Byte1('C')</DT
 
657
><DD
 
658
><P
 
659
>                Identifies the message as a Close command.</P
 
660
></DD
 
661
><DT
 
662
>Int32</DT
 
663
><DD
 
664
><P
 
665
>                Length of message contents in bytes, including self.</P
 
666
></DD
 
667
><DT
 
668
>Byte1</DT
 
669
><DD
 
670
><P
 
671
>                '<TT
 
672
CLASS="LITERAL"
 
673
>S</TT
 
674
>' to close a prepared statement; or
 
675
                '<TT
 
676
CLASS="LITERAL"
 
677
>P</TT
 
678
>' to close a portal.</P
 
679
></DD
 
680
><DT
 
681
>String</DT
 
682
><DD
 
683
><P
 
684
>                The name of the prepared statement or portal to close
 
685
                (an empty string selects the unnamed prepared statement
 
686
                or portal).</P
 
687
></DD
 
688
></DL
 
689
></DIV
 
690
><P></P
 
691
></DD
 
692
><DT
 
693
>CloseComplete (B)</DT
 
694
><DD
 
695
><P
 
696
>&#13;<P
 
697
></P
 
698
></P><DIV
 
699
CLASS="VARIABLELIST"
 
700
><DL
 
701
><DT
 
702
>Byte1('3')</DT
 
703
><DD
 
704
><P
 
705
>                Identifies the message as a Close-complete indicator.</P
 
706
></DD
 
707
><DT
 
708
>Int32(4)</DT
 
709
><DD
 
710
><P
 
711
>                Length of message contents in bytes, including self.</P
 
712
></DD
 
713
></DL
 
714
></DIV
 
715
><P>&#13;</P
 
716
></DD
 
717
><DT
 
718
>CommandComplete (B)</DT
 
719
><DD
 
720
><P
 
721
>&#13;<P
 
722
></P
 
723
></P><DIV
 
724
CLASS="VARIABLELIST"
 
725
><DL
 
726
><DT
 
727
>Byte1('C')</DT
 
728
><DD
 
729
><P
 
730
>                Identifies the message as a command-completed response.</P
 
731
></DD
 
732
><DT
 
733
>Int32</DT
 
734
><DD
 
735
><P
 
736
>                Length of message contents in bytes, including self.</P
 
737
></DD
 
738
><DT
 
739
>String</DT
 
740
><DD
 
741
><P
 
742
>        The command tag.  This is usually a single
 
743
        word that identifies which SQL command was completed.
 
744
       </P
 
745
><P
 
746
>        For an <TT
 
747
CLASS="COMMAND"
 
748
>INSERT</TT
 
749
> command, the tag is
 
750
        <TT
 
751
CLASS="LITERAL"
 
752
>INSERT <TT
 
753
CLASS="REPLACEABLE"
 
754
><I
 
755
>oid</I
 
756
></TT
 
757
>
 
758
        <TT
 
759
CLASS="REPLACEABLE"
 
760
><I
 
761
>rows</I
 
762
></TT
 
763
></TT
 
764
>, where
 
765
        <TT
 
766
CLASS="REPLACEABLE"
 
767
><I
 
768
>rows</I
 
769
></TT
 
770
> is the number of rows
 
771
        inserted. <TT
 
772
CLASS="REPLACEABLE"
 
773
><I
 
774
>oid</I
 
775
></TT
 
776
> is the object ID
 
777
        of the inserted row if <TT
 
778
CLASS="REPLACEABLE"
 
779
><I
 
780
>rows</I
 
781
></TT
 
782
> is 1
 
783
        and the target table has OIDs;
 
784
        otherwise <TT
 
785
CLASS="REPLACEABLE"
 
786
><I
 
787
>oid</I
 
788
></TT
 
789
> is 0.
 
790
       </P
 
791
><P
 
792
>        For a <TT
 
793
CLASS="COMMAND"
 
794
>DELETE</TT
 
795
> command, the tag is
 
796
        <TT
 
797
CLASS="LITERAL"
 
798
>DELETE <TT
 
799
CLASS="REPLACEABLE"
 
800
><I
 
801
>rows</I
 
802
></TT
 
803
></TT
 
804
> where
 
805
        <TT
 
806
CLASS="REPLACEABLE"
 
807
><I
 
808
>rows</I
 
809
></TT
 
810
> is the number of rows deleted.
 
811
       </P
 
812
><P
 
813
>        For an <TT
 
814
CLASS="COMMAND"
 
815
>UPDATE</TT
 
816
> command, the tag is
 
817
        <TT
 
818
CLASS="LITERAL"
 
819
>UPDATE <TT
 
820
CLASS="REPLACEABLE"
 
821
><I
 
822
>rows</I
 
823
></TT
 
824
></TT
 
825
> where
 
826
        <TT
 
827
CLASS="REPLACEABLE"
 
828
><I
 
829
>rows</I
 
830
></TT
 
831
> is the number of rows updated.
 
832
       </P
 
833
><P
 
834
>        For a <TT
 
835
CLASS="COMMAND"
 
836
>SELECT</TT
 
837
> or <TT
 
838
CLASS="COMMAND"
 
839
>CREATE TABLE AS</TT
 
840
>
 
841
        command, the tag is <TT
 
842
CLASS="LITERAL"
 
843
>SELECT <TT
 
844
CLASS="REPLACEABLE"
 
845
><I
 
846
>rows</I
 
847
></TT
 
848
></TT
 
849
>
 
850
        where <TT
 
851
CLASS="REPLACEABLE"
 
852
><I
 
853
>rows</I
 
854
></TT
 
855
> is the number of rows retrieved.
 
856
       </P
 
857
><P
 
858
>        For a <TT
 
859
CLASS="COMMAND"
 
860
>MOVE</TT
 
861
> command, the tag is
 
862
        <TT
 
863
CLASS="LITERAL"
 
864
>MOVE <TT
 
865
CLASS="REPLACEABLE"
 
866
><I
 
867
>rows</I
 
868
></TT
 
869
></TT
 
870
> where
 
871
        <TT
 
872
CLASS="REPLACEABLE"
 
873
><I
 
874
>rows</I
 
875
></TT
 
876
> is the number of rows the
 
877
        cursor's position has been changed by.
 
878
       </P
 
879
><P
 
880
>        For a <TT
 
881
CLASS="COMMAND"
 
882
>FETCH</TT
 
883
> command, the tag is
 
884
        <TT
 
885
CLASS="LITERAL"
 
886
>FETCH <TT
 
887
CLASS="REPLACEABLE"
 
888
><I
 
889
>rows</I
 
890
></TT
 
891
></TT
 
892
> where
 
893
        <TT
 
894
CLASS="REPLACEABLE"
 
895
><I
 
896
>rows</I
 
897
></TT
 
898
> is the number of rows that
 
899
        have been retrieved from the cursor.
 
900
       </P
 
901
><P
 
902
>        For a <TT
 
903
CLASS="COMMAND"
 
904
>COPY</TT
 
905
> command, the tag is
 
906
        <TT
 
907
CLASS="LITERAL"
 
908
>COPY <TT
 
909
CLASS="REPLACEABLE"
 
910
><I
 
911
>rows</I
 
912
></TT
 
913
></TT
 
914
> where
 
915
        <TT
 
916
CLASS="REPLACEABLE"
 
917
><I
 
918
>rows</I
 
919
></TT
 
920
> is the number of rows copied.
 
921
        (Note: the row count appears only in
 
922
        <SPAN
 
923
CLASS="PRODUCTNAME"
 
924
>PostgreSQL</SPAN
 
925
> 8.2 and later.)
 
926
       </P
 
927
></DD
 
928
></DL
 
929
></DIV
 
930
><P>&#13;</P
 
931
></DD
 
932
><DT
 
933
>CopyData (F &amp; B)</DT
 
934
><DD
 
935
><P
 
936
><P
 
937
></P
 
938
></P><DIV
 
939
CLASS="VARIABLELIST"
 
940
><DL
 
941
><DT
 
942
>Byte1('d')</DT
 
943
><DD
 
944
><P
 
945
>                Identifies the message as <TT
 
946
CLASS="COMMAND"
 
947
>COPY</TT
 
948
> data.</P
 
949
></DD
 
950
><DT
 
951
>Int32</DT
 
952
><DD
 
953
><P
 
954
>                Length of message contents in bytes, including self.</P
 
955
></DD
 
956
><DT
 
957
>Byte<TT
 
958
CLASS="REPLACEABLE"
 
959
><I
 
960
>n</I
 
961
></TT
 
962
></DT
 
963
><DD
 
964
><P
 
965
>                Data that forms part of a <TT
 
966
CLASS="COMMAND"
 
967
>COPY</TT
 
968
> data stream.  Messages sent
 
969
                from the backend will always correspond to single data rows,
 
970
                but messages sent by frontends might divide the data stream
 
971
                arbitrarily.</P
 
972
></DD
 
973
></DL
 
974
></DIV
 
975
><P></P
 
976
></DD
 
977
><DT
 
978
>CopyDone (F &amp; B)</DT
 
979
><DD
 
980
><P
 
981
>&#13;<P
 
982
></P
 
983
></P><DIV
 
984
CLASS="VARIABLELIST"
 
985
><DL
 
986
><DT
 
987
>Byte1('c')</DT
 
988
><DD
 
989
><P
 
990
>                Identifies the message as a <TT
 
991
CLASS="COMMAND"
 
992
>COPY</TT
 
993
>-complete indicator.</P
 
994
></DD
 
995
><DT
 
996
>Int32(4)</DT
 
997
><DD
 
998
><P
 
999
>                Length of message contents in bytes, including self.</P
 
1000
></DD
 
1001
></DL
 
1002
></DIV
 
1003
><P>&#13;</P
 
1004
></DD
 
1005
><DT
 
1006
>CopyFail (F)</DT
 
1007
><DD
 
1008
><P
 
1009
>&#13;<P
 
1010
></P
 
1011
></P><DIV
 
1012
CLASS="VARIABLELIST"
 
1013
><DL
 
1014
><DT
 
1015
>Byte1('f')</DT
 
1016
><DD
 
1017
><P
 
1018
>                Identifies the message as a <TT
 
1019
CLASS="COMMAND"
 
1020
>COPY</TT
 
1021
>-failure indicator.</P
 
1022
></DD
 
1023
><DT
 
1024
>Int32</DT
 
1025
><DD
 
1026
><P
 
1027
>                Length of message contents in bytes, including self.</P
 
1028
></DD
 
1029
><DT
 
1030
>String</DT
 
1031
><DD
 
1032
><P
 
1033
>                An error message to report as the cause of failure.</P
 
1034
></DD
 
1035
></DL
 
1036
></DIV
 
1037
><P>&#13;</P
 
1038
></DD
 
1039
><DT
 
1040
>CopyInResponse (B)</DT
 
1041
><DD
 
1042
><P
 
1043
>&#13;<P
 
1044
></P
 
1045
></P><DIV
 
1046
CLASS="VARIABLELIST"
 
1047
><DL
 
1048
><DT
 
1049
>Byte1('G')</DT
 
1050
><DD
 
1051
><P
 
1052
>                Identifies the message as a Start Copy In response.
 
1053
                The frontend must now send copy-in data (if not
 
1054
                prepared to do so, send a CopyFail message).</P
 
1055
></DD
 
1056
><DT
 
1057
>Int32</DT
 
1058
><DD
 
1059
><P
 
1060
>                Length of message contents in bytes, including self.</P
 
1061
></DD
 
1062
><DT
 
1063
>Int8</DT
 
1064
><DD
 
1065
><P
 
1066
>                0 indicates the overall <TT
 
1067
CLASS="COMMAND"
 
1068
>COPY</TT
 
1069
> format is textual (rows
 
1070
                separated by newlines, columns separated by separator
 
1071
                characters, etc).
 
1072
                1 indicates the overall copy format is binary (similar
 
1073
                to DataRow format).
 
1074
                See <A
 
1075
HREF="sql-copy.html"
 
1076
>COPY</A
 
1077
>
 
1078
                for more information.</P
 
1079
></DD
 
1080
><DT
 
1081
>Int16</DT
 
1082
><DD
 
1083
><P
 
1084
>                The number of columns in the data to be copied
 
1085
                (denoted <TT
 
1086
CLASS="REPLACEABLE"
 
1087
><I
 
1088
>N</I
 
1089
></TT
 
1090
> below).</P
 
1091
></DD
 
1092
><DT
 
1093
>Int16[<TT
 
1094
CLASS="REPLACEABLE"
 
1095
><I
 
1096
>N</I
 
1097
></TT
 
1098
>]</DT
 
1099
><DD
 
1100
><P
 
1101
>                The format codes to be used for each column.
 
1102
                Each must presently be zero (text) or one (binary).
 
1103
                All must be zero if the overall copy format is textual.</P
 
1104
></DD
 
1105
></DL
 
1106
></DIV
 
1107
><P>&#13;</P
 
1108
></DD
 
1109
><DT
 
1110
>CopyOutResponse (B)</DT
 
1111
><DD
 
1112
><P
 
1113
>&#13;<P
 
1114
></P
 
1115
></P><DIV
 
1116
CLASS="VARIABLELIST"
 
1117
><DL
 
1118
><DT
 
1119
>Byte1('H')</DT
 
1120
><DD
 
1121
><P
 
1122
>                Identifies the message as a Start Copy Out response.
 
1123
                This message will be followed by copy-out data.</P
 
1124
></DD
 
1125
><DT
 
1126
>Int32</DT
 
1127
><DD
 
1128
><P
 
1129
>                Length of message contents in bytes, including self.</P
 
1130
></DD
 
1131
><DT
 
1132
>Int8</DT
 
1133
><DD
 
1134
><P
 
1135
>                0 indicates the overall <TT
 
1136
CLASS="COMMAND"
 
1137
>COPY</TT
 
1138
> format
 
1139
                is textual (rows separated by newlines, columns
 
1140
                separated by separator characters, etc). 1 indicates
 
1141
                the overall copy format is binary (similar to DataRow
 
1142
                format). See <A
 
1143
HREF="sql-copy.html"
 
1144
>COPY</A
 
1145
> for more information.</P
 
1146
></DD
 
1147
><DT
 
1148
>Int16</DT
 
1149
><DD
 
1150
><P
 
1151
>                The number of columns in the data to be copied
 
1152
                (denoted <TT
 
1153
CLASS="REPLACEABLE"
 
1154
><I
 
1155
>N</I
 
1156
></TT
 
1157
> below).</P
 
1158
></DD
 
1159
><DT
 
1160
>Int16[<TT
 
1161
CLASS="REPLACEABLE"
 
1162
><I
 
1163
>N</I
 
1164
></TT
 
1165
>]</DT
 
1166
><DD
 
1167
><P
 
1168
>                The format codes to be used for each column.
 
1169
                Each must presently be zero (text) or one (binary).
 
1170
                All must be zero if the overall copy format is textual.</P
 
1171
></DD
 
1172
></DL
 
1173
></DIV
 
1174
><P>&#13;</P
 
1175
></DD
 
1176
><DT
 
1177
>CopyBothResponse (B)</DT
 
1178
><DD
 
1179
><P
 
1180
>&#13;<P
 
1181
></P
 
1182
></P><DIV
 
1183
CLASS="VARIABLELIST"
 
1184
><DL
 
1185
><DT
 
1186
>Byte1('W')</DT
 
1187
><DD
 
1188
><P
 
1189
>                Identifies the message as a Start Copy Both response.
 
1190
                This message is used only for Streaming Replication.</P
 
1191
></DD
 
1192
><DT
 
1193
>Int32</DT
 
1194
><DD
 
1195
><P
 
1196
>                Length of message contents in bytes, including self.</P
 
1197
></DD
 
1198
><DT
 
1199
>Int8</DT
 
1200
><DD
 
1201
><P
 
1202
>                0 indicates the overall <TT
 
1203
CLASS="COMMAND"
 
1204
>COPY</TT
 
1205
> format
 
1206
                is textual (rows separated by newlines, columns
 
1207
                separated by separator characters, etc). 1 indicates
 
1208
                the overall copy format is binary (similar to DataRow
 
1209
                format). See <A
 
1210
HREF="sql-copy.html"
 
1211
>COPY</A
 
1212
> for more information.</P
 
1213
></DD
 
1214
><DT
 
1215
>Int16</DT
 
1216
><DD
 
1217
><P
 
1218
>                The number of columns in the data to be copied
 
1219
                (denoted <TT
 
1220
CLASS="REPLACEABLE"
 
1221
><I
 
1222
>N</I
 
1223
></TT
 
1224
> below).</P
 
1225
></DD
 
1226
><DT
 
1227
>Int16[<TT
 
1228
CLASS="REPLACEABLE"
 
1229
><I
 
1230
>N</I
 
1231
></TT
 
1232
>]</DT
 
1233
><DD
 
1234
><P
 
1235
>                The format codes to be used for each column.
 
1236
                Each must presently be zero (text) or one (binary).
 
1237
                All must be zero if the overall copy format is textual.</P
 
1238
></DD
 
1239
></DL
 
1240
></DIV
 
1241
><P>&#13;</P
 
1242
></DD
 
1243
><DT
 
1244
>DataRow (B)</DT
 
1245
><DD
 
1246
><P
 
1247
><P
 
1248
></P
 
1249
></P><DIV
 
1250
CLASS="VARIABLELIST"
 
1251
><DL
 
1252
><DT
 
1253
>Byte1('D')</DT
 
1254
><DD
 
1255
><P
 
1256
>                Identifies the message as a data row.</P
 
1257
></DD
 
1258
><DT
 
1259
>Int32</DT
 
1260
><DD
 
1261
><P
 
1262
>                Length of message contents in bytes, including self.</P
 
1263
></DD
 
1264
><DT
 
1265
>Int16</DT
 
1266
><DD
 
1267
><P
 
1268
>                The number of column values that follow (possibly zero).</P
 
1269
></DD
 
1270
></DL
 
1271
></DIV
 
1272
><P>
 
1273
        Next, the following pair of fields appear for each column:
 
1274
<P
 
1275
></P
 
1276
></P><DIV
 
1277
CLASS="VARIABLELIST"
 
1278
><DL
 
1279
><DT
 
1280
>Int32</DT
 
1281
><DD
 
1282
><P
 
1283
>                The length of the column value, in bytes (this count
 
1284
                does not include itself).  Can be zero.
 
1285
                As a special case, -1 indicates a NULL column value.
 
1286
                No value bytes follow in the NULL case.</P
 
1287
></DD
 
1288
><DT
 
1289
>Byte<TT
 
1290
CLASS="REPLACEABLE"
 
1291
><I
 
1292
>n</I
 
1293
></TT
 
1294
></DT
 
1295
><DD
 
1296
><P
 
1297
>                The value of the column, in the format indicated by the
 
1298
                associated format code.
 
1299
                <TT
 
1300
CLASS="REPLACEABLE"
 
1301
><I
 
1302
>n</I
 
1303
></TT
 
1304
> is the above length.</P
 
1305
></DD
 
1306
></DL
 
1307
></DIV
 
1308
><P>&#13;</P
 
1309
></DD
 
1310
><DT
 
1311
>Describe (F)</DT
 
1312
><DD
 
1313
><P
 
1314
>&#13;<P
 
1315
></P
 
1316
></P><DIV
 
1317
CLASS="VARIABLELIST"
 
1318
><DL
 
1319
><DT
 
1320
>Byte1('D')</DT
 
1321
><DD
 
1322
><P
 
1323
>                Identifies the message as a Describe command.</P
 
1324
></DD
 
1325
><DT
 
1326
>Int32</DT
 
1327
><DD
 
1328
><P
 
1329
>                Length of message contents in bytes, including self.</P
 
1330
></DD
 
1331
><DT
 
1332
>Byte1</DT
 
1333
><DD
 
1334
><P
 
1335
>                '<TT
 
1336
CLASS="LITERAL"
 
1337
>S</TT
 
1338
>' to describe a prepared statement; or
 
1339
                '<TT
 
1340
CLASS="LITERAL"
 
1341
>P</TT
 
1342
>' to describe a portal.</P
 
1343
></DD
 
1344
><DT
 
1345
>String</DT
 
1346
><DD
 
1347
><P
 
1348
>                The name of the prepared statement or portal to describe
 
1349
                (an empty string selects the unnamed prepared statement
 
1350
                or portal).</P
 
1351
></DD
 
1352
></DL
 
1353
></DIV
 
1354
><P></P
 
1355
></DD
 
1356
><DT
 
1357
>EmptyQueryResponse (B)</DT
 
1358
><DD
 
1359
><P
 
1360
>&#13;<P
 
1361
></P
 
1362
></P><DIV
 
1363
CLASS="VARIABLELIST"
 
1364
><DL
 
1365
><DT
 
1366
>Byte1('I')</DT
 
1367
><DD
 
1368
><P
 
1369
>                Identifies the message as a response to an empty query string.
 
1370
                (This substitutes for CommandComplete.)</P
 
1371
></DD
 
1372
><DT
 
1373
>Int32(4)</DT
 
1374
><DD
 
1375
><P
 
1376
>                Length of message contents in bytes, including self.</P
 
1377
></DD
 
1378
></DL
 
1379
></DIV
 
1380
><P>&#13;</P
 
1381
></DD
 
1382
><DT
 
1383
>ErrorResponse (B)</DT
 
1384
><DD
 
1385
><P
 
1386
>&#13;<P
 
1387
></P
 
1388
></P><DIV
 
1389
CLASS="VARIABLELIST"
 
1390
><DL
 
1391
><DT
 
1392
>Byte1('E')</DT
 
1393
><DD
 
1394
><P
 
1395
>                Identifies the message as an error.</P
 
1396
></DD
 
1397
><DT
 
1398
>Int32</DT
 
1399
><DD
 
1400
><P
 
1401
>                Length of message contents in bytes, including self.</P
 
1402
></DD
 
1403
></DL
 
1404
></DIV
 
1405
><P>
 
1406
        The message body consists of one or more identified fields,
 
1407
        followed by a zero byte as a terminator.  Fields can appear in
 
1408
        any order.  For each field there is the following:
 
1409
<P
 
1410
></P
 
1411
></P><DIV
 
1412
CLASS="VARIABLELIST"
 
1413
><DL
 
1414
><DT
 
1415
>Byte1</DT
 
1416
><DD
 
1417
><P
 
1418
>                A code identifying the field type; if zero, this is
 
1419
                the message terminator and no string follows.
 
1420
                The presently defined field types are listed in
 
1421
                <A
 
1422
HREF="protocol-error-fields.html"
 
1423
>Section 46.6</A
 
1424
>.
 
1425
                Since more field types might be added in future,
 
1426
                frontends should silently ignore fields of unrecognized
 
1427
                type.</P
 
1428
></DD
 
1429
><DT
 
1430
>String</DT
 
1431
><DD
 
1432
><P
 
1433
>                The field value.</P
 
1434
></DD
 
1435
></DL
 
1436
></DIV
 
1437
><P>&#13;</P
 
1438
></DD
 
1439
><DT
 
1440
>Execute (F)</DT
 
1441
><DD
 
1442
><P
 
1443
>&#13;<P
 
1444
></P
 
1445
></P><DIV
 
1446
CLASS="VARIABLELIST"
 
1447
><DL
 
1448
><DT
 
1449
>Byte1('E')</DT
 
1450
><DD
 
1451
><P
 
1452
>                Identifies the message as an Execute command.</P
 
1453
></DD
 
1454
><DT
 
1455
>Int32</DT
 
1456
><DD
 
1457
><P
 
1458
>                Length of message contents in bytes, including self.</P
 
1459
></DD
 
1460
><DT
 
1461
>String</DT
 
1462
><DD
 
1463
><P
 
1464
>                The name of the portal to execute
 
1465
                (an empty string selects the unnamed portal).</P
 
1466
></DD
 
1467
><DT
 
1468
>Int32</DT
 
1469
><DD
 
1470
><P
 
1471
>                Maximum number of rows to return, if portal contains
 
1472
                a query that returns rows (ignored otherwise).  Zero
 
1473
                denotes <SPAN
 
1474
CLASS="QUOTE"
 
1475
>"no limit"</SPAN
 
1476
>.</P
 
1477
></DD
 
1478
></DL
 
1479
></DIV
 
1480
><P></P
 
1481
></DD
 
1482
><DT
 
1483
>Flush (F)</DT
 
1484
><DD
 
1485
><P
 
1486
>&#13;<P
 
1487
></P
 
1488
></P><DIV
 
1489
CLASS="VARIABLELIST"
 
1490
><DL
 
1491
><DT
 
1492
>Byte1('H')</DT
 
1493
><DD
 
1494
><P
 
1495
>                Identifies the message as a Flush command.</P
 
1496
></DD
 
1497
><DT
 
1498
>Int32(4)</DT
 
1499
><DD
 
1500
><P
 
1501
>                Length of message contents in bytes, including self.</P
 
1502
></DD
 
1503
></DL
 
1504
></DIV
 
1505
><P>&#13;</P
 
1506
></DD
 
1507
><DT
 
1508
>FunctionCall (F)</DT
 
1509
><DD
 
1510
><P
 
1511
>&#13;<P
 
1512
></P
 
1513
></P><DIV
 
1514
CLASS="VARIABLELIST"
 
1515
><DL
 
1516
><DT
 
1517
>Byte1('F')</DT
 
1518
><DD
 
1519
><P
 
1520
>                Identifies the message as a function call.</P
 
1521
></DD
 
1522
><DT
 
1523
>Int32</DT
 
1524
><DD
 
1525
><P
 
1526
>                Length of message contents in bytes, including self.</P
 
1527
></DD
 
1528
><DT
 
1529
>Int32</DT
 
1530
><DD
 
1531
><P
 
1532
>                Specifies the object ID of the function to call.</P
 
1533
></DD
 
1534
><DT
 
1535
>Int16</DT
 
1536
><DD
 
1537
><P
 
1538
>                The number of argument format codes that follow
 
1539
                (denoted <TT
 
1540
CLASS="REPLACEABLE"
 
1541
><I
 
1542
>C</I
 
1543
></TT
 
1544
> below).
 
1545
                This can be zero to indicate that there are no arguments
 
1546
                or that the arguments all use the default format (text);
 
1547
                or one, in which case the specified format code is applied
 
1548
                to all arguments; or it can equal the actual number of
 
1549
                arguments.</P
 
1550
></DD
 
1551
><DT
 
1552
>Int16[<TT
 
1553
CLASS="REPLACEABLE"
 
1554
><I
 
1555
>C</I
 
1556
></TT
 
1557
>]</DT
 
1558
><DD
 
1559
><P
 
1560
>                The argument format codes.  Each must presently be
 
1561
                zero (text) or one (binary).</P
 
1562
></DD
 
1563
><DT
 
1564
>Int16</DT
 
1565
><DD
 
1566
><P
 
1567
>                Specifies the number of arguments being supplied to the
 
1568
                function.</P
 
1569
></DD
 
1570
></DL
 
1571
></DIV
 
1572
><P>
 
1573
        Next, the following pair of fields appear for each argument:
 
1574
<P
 
1575
></P
 
1576
></P><DIV
 
1577
CLASS="VARIABLELIST"
 
1578
><DL
 
1579
><DT
 
1580
>Int32</DT
 
1581
><DD
 
1582
><P
 
1583
>                The length of the argument value, in bytes (this count
 
1584
                does not include itself).  Can be zero.
 
1585
                As a special case, -1 indicates a NULL argument value.
 
1586
                No value bytes follow in the NULL case.</P
 
1587
></DD
 
1588
><DT
 
1589
>Byte<TT
 
1590
CLASS="REPLACEABLE"
 
1591
><I
 
1592
>n</I
 
1593
></TT
 
1594
></DT
 
1595
><DD
 
1596
><P
 
1597
>                The value of the argument, in the format indicated by the
 
1598
                associated format code.
 
1599
                <TT
 
1600
CLASS="REPLACEABLE"
 
1601
><I
 
1602
>n</I
 
1603
></TT
 
1604
> is the above length.</P
 
1605
></DD
 
1606
></DL
 
1607
></DIV
 
1608
><P>
 
1609
        After the last argument, the following field appears:
 
1610
<P
 
1611
></P
 
1612
></P><DIV
 
1613
CLASS="VARIABLELIST"
 
1614
><DL
 
1615
><DT
 
1616
>Int16</DT
 
1617
><DD
 
1618
><P
 
1619
>                The format code for the function result. Must presently be
 
1620
                zero (text) or one (binary).</P
 
1621
></DD
 
1622
></DL
 
1623
></DIV
 
1624
><P>&#13;</P
 
1625
></DD
 
1626
><DT
 
1627
>FunctionCallResponse (B)</DT
 
1628
><DD
 
1629
><P
 
1630
>&#13;<P
 
1631
></P
 
1632
></P><DIV
 
1633
CLASS="VARIABLELIST"
 
1634
><DL
 
1635
><DT
 
1636
>Byte1('V')</DT
 
1637
><DD
 
1638
><P
 
1639
>                Identifies the message as a function call result.</P
 
1640
></DD
 
1641
><DT
 
1642
>Int32</DT
 
1643
><DD
 
1644
><P
 
1645
>                Length of message contents in bytes, including self.</P
 
1646
></DD
 
1647
><DT
 
1648
>Int32</DT
 
1649
><DD
 
1650
><P
 
1651
>                The length of the function result value, in bytes (this count
 
1652
                does not include itself).  Can be zero.
 
1653
                As a special case, -1 indicates a NULL function result.
 
1654
                No value bytes follow in the NULL case.</P
 
1655
></DD
 
1656
><DT
 
1657
>Byte<TT
 
1658
CLASS="REPLACEABLE"
 
1659
><I
 
1660
>n</I
 
1661
></TT
 
1662
></DT
 
1663
><DD
 
1664
><P
 
1665
>                The value of the function result, in the format indicated by
 
1666
                the associated format code.
 
1667
                <TT
 
1668
CLASS="REPLACEABLE"
 
1669
><I
 
1670
>n</I
 
1671
></TT
 
1672
> is the above length.</P
 
1673
></DD
 
1674
></DL
 
1675
></DIV
 
1676
><P>&#13;</P
 
1677
></DD
 
1678
><DT
 
1679
>NoData (B)</DT
 
1680
><DD
 
1681
><P
 
1682
>&#13;<P
 
1683
></P
 
1684
></P><DIV
 
1685
CLASS="VARIABLELIST"
 
1686
><DL
 
1687
><DT
 
1688
>Byte1('n')</DT
 
1689
><DD
 
1690
><P
 
1691
>                Identifies the message as a no-data indicator.</P
 
1692
></DD
 
1693
><DT
 
1694
>Int32(4)</DT
 
1695
><DD
 
1696
><P
 
1697
>                Length of message contents in bytes, including self.</P
 
1698
></DD
 
1699
></DL
 
1700
></DIV
 
1701
><P>&#13;</P
 
1702
></DD
 
1703
><DT
 
1704
>NoticeResponse (B)</DT
 
1705
><DD
 
1706
><P
 
1707
>&#13;<P
 
1708
></P
 
1709
></P><DIV
 
1710
CLASS="VARIABLELIST"
 
1711
><DL
 
1712
><DT
 
1713
>Byte1('N')</DT
 
1714
><DD
 
1715
><P
 
1716
>                Identifies the message as a notice.</P
 
1717
></DD
 
1718
><DT
 
1719
>Int32</DT
 
1720
><DD
 
1721
><P
 
1722
>                Length of message contents in bytes, including self.</P
 
1723
></DD
 
1724
></DL
 
1725
></DIV
 
1726
><P>
 
1727
        The message body consists of one or more identified fields,
 
1728
        followed by a zero byte as a terminator.  Fields can appear in
 
1729
        any order.  For each field there is the following:
 
1730
<P
 
1731
></P
 
1732
></P><DIV
 
1733
CLASS="VARIABLELIST"
 
1734
><DL
 
1735
><DT
 
1736
>Byte1</DT
 
1737
><DD
 
1738
><P
 
1739
>                A code identifying the field type; if zero, this is
 
1740
                the message terminator and no string follows.
 
1741
                The presently defined field types are listed in
 
1742
                <A
 
1743
HREF="protocol-error-fields.html"
 
1744
>Section 46.6</A
 
1745
>.
 
1746
                Since more field types might be added in future,
 
1747
                frontends should silently ignore fields of unrecognized
 
1748
                type.</P
 
1749
></DD
 
1750
><DT
 
1751
>String</DT
 
1752
><DD
 
1753
><P
 
1754
>                The field value.</P
 
1755
></DD
 
1756
></DL
 
1757
></DIV
 
1758
><P>&#13;</P
 
1759
></DD
 
1760
><DT
 
1761
>NotificationResponse (B)</DT
 
1762
><DD
 
1763
><P
 
1764
>&#13;<P
 
1765
></P
 
1766
></P><DIV
 
1767
CLASS="VARIABLELIST"
 
1768
><DL
 
1769
><DT
 
1770
>Byte1('A')</DT
 
1771
><DD
 
1772
><P
 
1773
>                Identifies the message as a notification response.</P
 
1774
></DD
 
1775
><DT
 
1776
>Int32</DT
 
1777
><DD
 
1778
><P
 
1779
>                Length of message contents in bytes, including self.</P
 
1780
></DD
 
1781
><DT
 
1782
>Int32</DT
 
1783
><DD
 
1784
><P
 
1785
>                The process ID of the notifying backend process.</P
 
1786
></DD
 
1787
><DT
 
1788
>String</DT
 
1789
><DD
 
1790
><P
 
1791
>                The name of the channel that the notify has been raised on.</P
 
1792
></DD
 
1793
><DT
 
1794
>String</DT
 
1795
><DD
 
1796
><P
 
1797
>                The <SPAN
 
1798
CLASS="QUOTE"
 
1799
>"payload"</SPAN
 
1800
> string passed from the notifying process.</P
 
1801
></DD
 
1802
></DL
 
1803
></DIV
 
1804
><P>&#13;</P
 
1805
></DD
 
1806
><DT
 
1807
>ParameterDescription (B)</DT
 
1808
><DD
 
1809
><P
 
1810
>&#13;<P
 
1811
></P
 
1812
></P><DIV
 
1813
CLASS="VARIABLELIST"
 
1814
><DL
 
1815
><DT
 
1816
>Byte1('t')</DT
 
1817
><DD
 
1818
><P
 
1819
>                Identifies the message as a parameter description.</P
 
1820
></DD
 
1821
><DT
 
1822
>Int32</DT
 
1823
><DD
 
1824
><P
 
1825
>                Length of message contents in bytes, including self.</P
 
1826
></DD
 
1827
><DT
 
1828
>Int16</DT
 
1829
><DD
 
1830
><P
 
1831
>                The number of parameters used by the statement
 
1832
                (can be zero).</P
 
1833
></DD
 
1834
></DL
 
1835
></DIV
 
1836
><P>
 
1837
        Then, for each parameter, there is the following:
 
1838
<P
 
1839
></P
 
1840
></P><DIV
 
1841
CLASS="VARIABLELIST"
 
1842
><DL
 
1843
><DT
 
1844
>Int32</DT
 
1845
><DD
 
1846
><P
 
1847
>                Specifies the object ID of the parameter data type.</P
 
1848
></DD
 
1849
></DL
 
1850
></DIV
 
1851
><P></P
 
1852
></DD
 
1853
><DT
 
1854
>ParameterStatus (B)</DT
 
1855
><DD
 
1856
><P
 
1857
>&#13;<P
 
1858
></P
 
1859
></P><DIV
 
1860
CLASS="VARIABLELIST"
 
1861
><DL
 
1862
><DT
 
1863
>Byte1('S')</DT
 
1864
><DD
 
1865
><P
 
1866
>                Identifies the message as a run-time parameter status report.</P
 
1867
></DD
 
1868
><DT
 
1869
>Int32</DT
 
1870
><DD
 
1871
><P
 
1872
>                Length of message contents in bytes, including self.</P
 
1873
></DD
 
1874
><DT
 
1875
>String</DT
 
1876
><DD
 
1877
><P
 
1878
>                The name of the run-time parameter being reported.</P
 
1879
></DD
 
1880
><DT
 
1881
>String</DT
 
1882
><DD
 
1883
><P
 
1884
>                The current value of the parameter.</P
 
1885
></DD
 
1886
></DL
 
1887
></DIV
 
1888
><P></P
 
1889
></DD
 
1890
><DT
 
1891
>Parse (F)</DT
 
1892
><DD
 
1893
><P
 
1894
>&#13;<P
 
1895
></P
 
1896
></P><DIV
 
1897
CLASS="VARIABLELIST"
 
1898
><DL
 
1899
><DT
 
1900
>Byte1('P')</DT
 
1901
><DD
 
1902
><P
 
1903
>                Identifies the message as a Parse command.</P
 
1904
></DD
 
1905
><DT
 
1906
>Int32</DT
 
1907
><DD
 
1908
><P
 
1909
>                Length of message contents in bytes, including self.</P
 
1910
></DD
 
1911
><DT
 
1912
>String</DT
 
1913
><DD
 
1914
><P
 
1915
>                The name of the destination prepared statement
 
1916
                (an empty string selects the unnamed prepared statement).</P
 
1917
></DD
 
1918
><DT
 
1919
>String</DT
 
1920
><DD
 
1921
><P
 
1922
>                The query string to be parsed.</P
 
1923
></DD
 
1924
><DT
 
1925
>Int16</DT
 
1926
><DD
 
1927
><P
 
1928
>                The number of parameter data types specified
 
1929
                (can be zero).  Note that this is not an indication of
 
1930
                the number of parameters that might appear in the
 
1931
                query string, only the number that the frontend wants to
 
1932
                prespecify types for.</P
 
1933
></DD
 
1934
></DL
 
1935
></DIV
 
1936
><P>
 
1937
        Then, for each parameter, there is the following:
 
1938
<P
 
1939
></P
 
1940
></P><DIV
 
1941
CLASS="VARIABLELIST"
 
1942
><DL
 
1943
><DT
 
1944
>Int32</DT
 
1945
><DD
 
1946
><P
 
1947
>                Specifies the object ID of the parameter data type.
 
1948
                Placing a zero here is equivalent to leaving the type
 
1949
                unspecified.</P
 
1950
></DD
 
1951
></DL
 
1952
></DIV
 
1953
><P></P
 
1954
></DD
 
1955
><DT
 
1956
>ParseComplete (B)</DT
 
1957
><DD
 
1958
><P
 
1959
>&#13;<P
 
1960
></P
 
1961
></P><DIV
 
1962
CLASS="VARIABLELIST"
 
1963
><DL
 
1964
><DT
 
1965
>Byte1('1')</DT
 
1966
><DD
 
1967
><P
 
1968
>                Identifies the message as a Parse-complete indicator.</P
 
1969
></DD
 
1970
><DT
 
1971
>Int32(4)</DT
 
1972
><DD
 
1973
><P
 
1974
>                Length of message contents in bytes, including self.</P
 
1975
></DD
 
1976
></DL
 
1977
></DIV
 
1978
><P>&#13;</P
 
1979
></DD
 
1980
><DT
 
1981
>PasswordMessage (F)</DT
 
1982
><DD
 
1983
><P
 
1984
>&#13;<P
 
1985
></P
 
1986
></P><DIV
 
1987
CLASS="VARIABLELIST"
 
1988
><DL
 
1989
><DT
 
1990
>Byte1('p')</DT
 
1991
><DD
 
1992
><P
 
1993
>                Identifies the message as a password response. Note that
 
1994
                this is also used for GSSAPI and SSPI response messages
 
1995
                (which is really a design error, since the contained data
 
1996
                is not a null-terminated string in that case, but can be
 
1997
                arbitrary binary data).</P
 
1998
></DD
 
1999
><DT
 
2000
>Int32</DT
 
2001
><DD
 
2002
><P
 
2003
>                Length of message contents in bytes, including self.</P
 
2004
></DD
 
2005
><DT
 
2006
>String</DT
 
2007
><DD
 
2008
><P
 
2009
>                The password (encrypted, if requested).</P
 
2010
></DD
 
2011
></DL
 
2012
></DIV
 
2013
><P></P
 
2014
></DD
 
2015
><DT
 
2016
>PortalSuspended (B)</DT
 
2017
><DD
 
2018
><P
 
2019
>&#13;<P
 
2020
></P
 
2021
></P><DIV
 
2022
CLASS="VARIABLELIST"
 
2023
><DL
 
2024
><DT
 
2025
>Byte1('s')</DT
 
2026
><DD
 
2027
><P
 
2028
>                Identifies the message as a portal-suspended indicator.
 
2029
                Note this only appears if an Execute message's row-count limit
 
2030
                was reached.</P
 
2031
></DD
 
2032
><DT
 
2033
>Int32(4)</DT
 
2034
><DD
 
2035
><P
 
2036
>                Length of message contents in bytes, including self.</P
 
2037
></DD
 
2038
></DL
 
2039
></DIV
 
2040
><P>&#13;</P
 
2041
></DD
 
2042
><DT
 
2043
>Query (F)</DT
 
2044
><DD
 
2045
><P
 
2046
>&#13;<P
 
2047
></P
 
2048
></P><DIV
 
2049
CLASS="VARIABLELIST"
 
2050
><DL
 
2051
><DT
 
2052
>Byte1('Q')</DT
 
2053
><DD
 
2054
><P
 
2055
>                Identifies the message as a simple query.</P
 
2056
></DD
 
2057
><DT
 
2058
>Int32</DT
 
2059
><DD
 
2060
><P
 
2061
>                Length of message contents in bytes, including self.</P
 
2062
></DD
 
2063
><DT
 
2064
>String</DT
 
2065
><DD
 
2066
><P
 
2067
>                The query string itself.</P
 
2068
></DD
 
2069
></DL
 
2070
></DIV
 
2071
><P>&#13;</P
 
2072
></DD
 
2073
><DT
 
2074
>ReadyForQuery (B)</DT
 
2075
><DD
 
2076
><P
 
2077
>&#13;<P
 
2078
></P
 
2079
></P><DIV
 
2080
CLASS="VARIABLELIST"
 
2081
><DL
 
2082
><DT
 
2083
>Byte1('Z')</DT
 
2084
><DD
 
2085
><P
 
2086
>                Identifies the message type.  ReadyForQuery is sent
 
2087
                whenever the backend is ready for a new query cycle.</P
 
2088
></DD
 
2089
><DT
 
2090
>Int32(5)</DT
 
2091
><DD
 
2092
><P
 
2093
>                Length of message contents in bytes, including self.</P
 
2094
></DD
 
2095
><DT
 
2096
>Byte1</DT
 
2097
><DD
 
2098
><P
 
2099
>                Current backend transaction status indicator.
 
2100
                Possible values are '<TT
 
2101
CLASS="LITERAL"
 
2102
>I</TT
 
2103
>' if idle (not in
 
2104
                a transaction block); '<TT
 
2105
CLASS="LITERAL"
 
2106
>T</TT
 
2107
>' if in a transaction
 
2108
                block; or '<TT
 
2109
CLASS="LITERAL"
 
2110
>E</TT
 
2111
>' if in a failed transaction
 
2112
                block (queries will be rejected until block is ended).</P
 
2113
></DD
 
2114
></DL
 
2115
></DIV
 
2116
><P>&#13;</P
 
2117
></DD
 
2118
><DT
 
2119
>RowDescription (B)</DT
 
2120
><DD
 
2121
><P
 
2122
>&#13;<P
 
2123
></P
 
2124
></P><DIV
 
2125
CLASS="VARIABLELIST"
 
2126
><DL
 
2127
><DT
 
2128
>Byte1('T')</DT
 
2129
><DD
 
2130
><P
 
2131
>                Identifies the message as a row description.</P
 
2132
></DD
 
2133
><DT
 
2134
>Int32</DT
 
2135
><DD
 
2136
><P
 
2137
>                Length of message contents in bytes, including self.</P
 
2138
></DD
 
2139
><DT
 
2140
>Int16</DT
 
2141
><DD
 
2142
><P
 
2143
>                Specifies the number of fields in a row (can be zero).</P
 
2144
></DD
 
2145
></DL
 
2146
></DIV
 
2147
><P>
 
2148
        Then, for each field, there is the following:
 
2149
<P
 
2150
></P
 
2151
></P><DIV
 
2152
CLASS="VARIABLELIST"
 
2153
><DL
 
2154
><DT
 
2155
>String</DT
 
2156
><DD
 
2157
><P
 
2158
>                The field name.</P
 
2159
></DD
 
2160
><DT
 
2161
>Int32</DT
 
2162
><DD
 
2163
><P
 
2164
>                If the field can be identified as a column of a specific
 
2165
                table, the object ID of the table; otherwise zero.</P
 
2166
></DD
 
2167
><DT
 
2168
>Int16</DT
 
2169
><DD
 
2170
><P
 
2171
>                If the field can be identified as a column of a specific
 
2172
                table, the attribute number of the column; otherwise zero.</P
 
2173
></DD
 
2174
><DT
 
2175
>Int32</DT
 
2176
><DD
 
2177
><P
 
2178
>                The object ID of the field's data type.</P
 
2179
></DD
 
2180
><DT
 
2181
>Int16</DT
 
2182
><DD
 
2183
><P
 
2184
>                The data type size (see <TT
 
2185
CLASS="VARNAME"
 
2186
>pg_type.typlen</TT
 
2187
>).
 
2188
                Note that negative values denote variable-width types.</P
 
2189
></DD
 
2190
><DT
 
2191
>Int32</DT
 
2192
><DD
 
2193
><P
 
2194
>                The type modifier (see <TT
 
2195
CLASS="VARNAME"
 
2196
>pg_attribute.atttypmod</TT
 
2197
>).
 
2198
                The meaning of the modifier is type-specific.</P
 
2199
></DD
 
2200
><DT
 
2201
>Int16</DT
 
2202
><DD
 
2203
><P
 
2204
>                The format code being used for the field.  Currently will
 
2205
                be zero (text) or one (binary).  In a RowDescription
 
2206
                returned from the statement variant of Describe, the
 
2207
                format code is not yet known and will always be zero.</P
 
2208
></DD
 
2209
></DL
 
2210
></DIV
 
2211
><P>&#13;</P
 
2212
></DD
 
2213
><DT
 
2214
>SSLRequest (F)</DT
 
2215
><DD
 
2216
><P
 
2217
>&#13;<P
 
2218
></P
 
2219
></P><DIV
 
2220
CLASS="VARIABLELIST"
 
2221
><DL
 
2222
><DT
 
2223
>Int32(8)</DT
 
2224
><DD
 
2225
><P
 
2226
>                Length of message contents in bytes, including self.</P
 
2227
></DD
 
2228
><DT
 
2229
>Int32(80877103)</DT
 
2230
><DD
 
2231
><P
 
2232
>                The <ACRONYM
 
2233
CLASS="ACRONYM"
 
2234
>SSL</ACRONYM
 
2235
> request code.  The value is chosen to contain
 
2236
                <TT
 
2237
CLASS="LITERAL"
 
2238
>1234</TT
 
2239
> in the most significant 16 bits, and <TT
 
2240
CLASS="LITERAL"
 
2241
>5679</TT
 
2242
> in the
 
2243
                least 16 significant bits.  (To avoid confusion, this code
 
2244
                must not be the same as any protocol version number.)</P
 
2245
></DD
 
2246
></DL
 
2247
></DIV
 
2248
><P>&#13;</P
 
2249
></DD
 
2250
><DT
 
2251
>StartupMessage (F)</DT
 
2252
><DD
 
2253
><P
 
2254
>&#13;<P
 
2255
></P
 
2256
></P><DIV
 
2257
CLASS="VARIABLELIST"
 
2258
><DL
 
2259
><DT
 
2260
>Int32</DT
 
2261
><DD
 
2262
><P
 
2263
>                Length of message contents in bytes, including self.</P
 
2264
></DD
 
2265
><DT
 
2266
>Int32(196608)</DT
 
2267
><DD
 
2268
><P
 
2269
>                The protocol version number.  The most significant 16 bits are
 
2270
                the major version number (3 for the protocol described here).
 
2271
                The least significant 16 bits are the minor version number
 
2272
                (0 for the protocol described here).</P
 
2273
></DD
 
2274
></DL
 
2275
></DIV
 
2276
><P>
 
2277
        The protocol version number is followed by one or more pairs of
 
2278
        parameter name and value strings.  A zero byte is required as a
 
2279
        terminator after the last name/value pair.
 
2280
        Parameters can appear in any
 
2281
        order.  <TT
 
2282
CLASS="LITERAL"
 
2283
>user</TT
 
2284
> is required, others are optional.
 
2285
        Each parameter is specified as:
 
2286
<P
 
2287
></P
 
2288
></P><DIV
 
2289
CLASS="VARIABLELIST"
 
2290
><DL
 
2291
><DT
 
2292
>String</DT
 
2293
><DD
 
2294
><P
 
2295
>                The parameter name.  Currently recognized names are:
 
2296
 
 
2297
<P
 
2298
></P
 
2299
></P><DIV
 
2300
CLASS="VARIABLELIST"
 
2301
><DL
 
2302
><DT
 
2303
><TT
 
2304
CLASS="LITERAL"
 
2305
>user</TT
 
2306
></DT
 
2307
><DD
 
2308
><P
 
2309
>                        The database user name to connect as.  Required;
 
2310
                        there is no default.</P
 
2311
></DD
 
2312
><DT
 
2313
><TT
 
2314
CLASS="LITERAL"
 
2315
>database</TT
 
2316
></DT
 
2317
><DD
 
2318
><P
 
2319
>                        The database to connect to.  Defaults to the user name.</P
 
2320
></DD
 
2321
><DT
 
2322
><TT
 
2323
CLASS="LITERAL"
 
2324
>options</TT
 
2325
></DT
 
2326
><DD
 
2327
><P
 
2328
>                        Command-line arguments for the backend.  (This is
 
2329
                        deprecated in favor of setting individual run-time
 
2330
                        parameters.)</P
 
2331
></DD
 
2332
></DL
 
2333
></DIV
 
2334
><P>
 
2335
 
 
2336
                In addition to the above, any run-time parameter that can be
 
2337
                set at backend start time might be listed.  Such settings
 
2338
                will be applied during backend start (after parsing the
 
2339
                command-line options if any).  The values will act as
 
2340
                session defaults.</P
 
2341
></DD
 
2342
><DT
 
2343
>String</DT
 
2344
><DD
 
2345
><P
 
2346
>                The parameter value.</P
 
2347
></DD
 
2348
></DL
 
2349
></DIV
 
2350
><P>&#13;</P
 
2351
></DD
 
2352
><DT
 
2353
>Sync (F)</DT
 
2354
><DD
 
2355
><P
 
2356
>&#13;<P
 
2357
></P
 
2358
></P><DIV
 
2359
CLASS="VARIABLELIST"
 
2360
><DL
 
2361
><DT
 
2362
>Byte1('S')</DT
 
2363
><DD
 
2364
><P
 
2365
>                Identifies the message as a Sync command.</P
 
2366
></DD
 
2367
><DT
 
2368
>Int32(4)</DT
 
2369
><DD
 
2370
><P
 
2371
>                Length of message contents in bytes, including self.</P
 
2372
></DD
 
2373
></DL
 
2374
></DIV
 
2375
><P>&#13;</P
 
2376
></DD
 
2377
><DT
 
2378
>Terminate (F)</DT
 
2379
><DD
 
2380
><P
 
2381
>&#13;<P
 
2382
></P
 
2383
></P><DIV
 
2384
CLASS="VARIABLELIST"
 
2385
><DL
 
2386
><DT
 
2387
>Byte1('X')</DT
 
2388
><DD
 
2389
><P
 
2390
>                Identifies the message as a termination.</P
 
2391
></DD
 
2392
><DT
 
2393
>Int32(4)</DT
 
2394
><DD
 
2395
><P
 
2396
>                Length of message contents in bytes, including self.</P
 
2397
></DD
 
2398
></DL
 
2399
></DIV
 
2400
><P>&#13;</P
 
2401
></DD
 
2402
></DL
 
2403
></DIV
 
2404
></DIV
 
2405
><DIV
 
2406
CLASS="NAVFOOTER"
 
2407
><HR
 
2408
ALIGN="LEFT"
 
2409
WIDTH="100%"><TABLE
 
2410
SUMMARY="Footer navigation table"
 
2411
WIDTH="100%"
 
2412
BORDER="0"
 
2413
CELLPADDING="0"
 
2414
CELLSPACING="0"
 
2415
><TR
 
2416
><TD
 
2417
WIDTH="33%"
 
2418
ALIGN="left"
 
2419
VALIGN="top"
 
2420
><A
 
2421
HREF="protocol-message-types.html"
 
2422
ACCESSKEY="P"
 
2423
>Prev</A
 
2424
></TD
 
2425
><TD
 
2426
WIDTH="34%"
 
2427
ALIGN="center"
 
2428
VALIGN="top"
 
2429
><A
 
2430
HREF="index.html"
 
2431
ACCESSKEY="H"
 
2432
>Home</A
 
2433
></TD
 
2434
><TD
 
2435
WIDTH="33%"
 
2436
ALIGN="right"
 
2437
VALIGN="top"
 
2438
><A
 
2439
HREF="protocol-error-fields.html"
 
2440
ACCESSKEY="N"
 
2441
>Next</A
 
2442
></TD
 
2443
></TR
 
2444
><TR
 
2445
><TD
 
2446
WIDTH="33%"
 
2447
ALIGN="left"
 
2448
VALIGN="top"
 
2449
>Message Data Types</TD
 
2450
><TD
 
2451
WIDTH="34%"
 
2452
ALIGN="center"
 
2453
VALIGN="top"
 
2454
><A
 
2455
HREF="protocol.html"
 
2456
ACCESSKEY="U"
 
2457
>Up</A
 
2458
></TD
 
2459
><TD
 
2460
WIDTH="33%"
 
2461
ALIGN="right"
 
2462
VALIGN="top"
 
2463
>Error and Notice Message Fields</TD
 
2464
></TR
 
2465
></TABLE
 
2466
></DIV
 
2467
></BODY
 
2468
></HTML
 
2469
>
 
 
b'\\ No newline at end of file'