2 54.10. Summary of Changes since Protocol 2.0 #
4 This section provides a quick checklist of changes, for the benefit of
5 developers trying to update existing client libraries to protocol 3.0.
7 The initial startup packet uses a flexible list-of-strings format
8 instead of a fixed format. Notice that session default values for
9 run-time parameters can now be specified directly in the startup
10 packet. (Actually, you could do that before using the options field,
11 but given the limited width of options and the lack of any way to quote
12 whitespace in the values, it wasn't a very safe technique.)
14 All messages now have a length count immediately following the message
15 type byte (except for startup packets, which have no type byte). Also
16 note that PasswordMessage now has a type byte.
18 ErrorResponse and NoticeResponse ('E' and 'N') messages now contain
19 multiple fields, from which the client code can assemble an error
20 message of the desired level of verbosity. Note that individual fields
21 will typically not end with a newline, whereas the single string sent
22 in the older protocol always did.
24 The ReadyForQuery ('Z') message includes a transaction status
27 The distinction between BinaryRow and DataRow message types is gone;
28 the single DataRow message type serves for returning data in all
29 formats. Note that the layout of DataRow has changed to make it easier
30 to parse. Also, the representation of binary values has changed: it is
31 no longer directly tied to the server's internal representation.
33 There is a new “extended query” sub-protocol, which adds the frontend
34 message types Parse, Bind, Execute, Describe, Close, Flush, and Sync,
35 and the backend message types ParseComplete, BindComplete,
36 PortalSuspended, ParameterDescription, NoData, and CloseComplete.
37 Existing clients do not have to concern themselves with this
38 sub-protocol, but making use of it might allow improvements in
39 performance or functionality.
41 COPY data is now encapsulated into CopyData and CopyDone messages.
42 There is a well-defined way to recover from errors during COPY. The
43 special “\.” last line is not needed anymore, and is not sent during
44 COPY OUT. (It is still recognized as a terminator during text-mode COPY
45 IN, but not in CSV mode. The text-mode behavior is deprecated and may
46 eventually be removed.) Binary COPY is supported. The CopyInResponse
47 and CopyOutResponse messages include fields indicating the number of
48 columns and the format of each column.
50 The layout of FunctionCall and FunctionCallResponse messages has
51 changed. FunctionCall can now support passing NULL arguments to
52 functions. It also can handle passing parameters and retrieving results
53 in either text or binary format. There is no longer any reason to
54 consider FunctionCall a potential security hole, since it does not
55 offer direct access to internal server data representations.
57 The backend sends ParameterStatus ('S') messages during connection
58 startup for all parameters it considers interesting to the client
59 library. Subsequently, a ParameterStatus message is sent whenever the
60 active value changes for any of these parameters.
62 The RowDescription ('T') message carries new table OID and column
63 number fields for each column of the described row. It also shows the
64 format code for each column.
66 The CursorResponse ('P') message is no longer generated by the backend.
68 The NotificationResponse ('A') message has an additional string field,
69 which can carry a “payload” string passed from the NOTIFY event sender.
71 The EmptyQueryResponse ('I') message used to include an empty string
72 parameter; this has been removed.