バージョンごとのドキュメント一覧

55.10. プロトコル2.0からの変更点の要約 #

<title>Summary of Changes since Protocol 2.0</title>

This section provides a quick checklist of changes, for the benefit of developers trying to update existing client libraries to protocol 3.0. 本節では、既存のクライアントライブラリをプロトコル3.0に更新しようとする開発者向けに、変更点の簡易チェックリストを示します。

The initial startup packet uses a flexible list-of-strings format instead of a fixed format. Notice that session default values for run-time parameters can now be specified directly in the startup packet. (Actually, you could do that before using the <literal>options</literal> field, but given the limited width of <literal>options</literal> and the lack of any way to quote whitespace in the values, it wasn't a very safe technique.) 最初の開始パケットは、固定書式ではなく、柔軟な文字列のリスト書式を使用します。 実行時パラメータのセッションのデフォルト値が直接開始パケット内に指定できるようになった点に注意してください。 (実際、以前でもoptionsフィールドを使用してこれを行うことができましたが、optionsには長さに制限があること、および値内の空白文字を引用符でくくる方法がないことから、あまり安全な技法ではありませんでした。)

All messages now have a length count immediately following the message type byte (except for startup packets, which have no type byte). Also note that PasswordMessage now has a type byte. すべてのメッセージが、メッセージ種類バイトの直後にバイト数を持つようになりました (種類バイトがない開始パケットは例外です)。 また、PasswordMessageが種類バイトを持つようになったことにも注意してください。

ErrorResponse and NoticeResponse ('<literal>E</literal>' and '<literal>N</literal>') messages now contain multiple fields, from which the client code can assemble an error message of the desired level of verbosity. Note that individual fields will typically not end with a newline, whereas the single string sent in the older protocol always did. ErrorResponseおよびNoticeResponse('E'および'N')メッセージが複数のフィールドを持つようになりました。 これを使用して、クライアントコードは、必要な冗長度に合わせて、エラーメッセージを組み立てることができます。 個々のフィールドが通常改行で終わらないことに注意してください。 単一の文字列を送信する古いプロトコルでは、常に改行で終わっていました。

The ReadyForQuery ('<literal>Z</literal>') message includes a transaction status indicator. ReadyForQuery('Z')メッセージに、トランザクション状態指示子が含まれます。

The distinction between BinaryRow and DataRow message types is gone; the single DataRow message type serves for returning data in all formats. Note that the layout of DataRow has changed to make it easier to parse. Also, the representation of binary values has changed: it is no longer directly tied to the server's internal representation. BinaryRowとDataRowメッセージ種類間の区別がなくなりました。 1つのDataRowメッセージ種類で、すべての書式で記述されたデータを返すことができます。 DataRowのレイアウトが解析しやすいように変更されたことに注意してください。 またバイナリ値の表現も変更されました。 もはやサーバの内部表現に直接束縛されません。

There is a new <quote>extended query</quote> sub-protocol, which adds the frontend message types Parse, Bind, Execute, Describe, Close, Flush, and Sync, and the backend message types ParseComplete, BindComplete, PortalSuspended, ParameterDescription, NoData, and CloseComplete. Existing clients do not have to concern themselves with this sub-protocol, but making use of it might allow improvements in performance or functionality. 新しい拡張問い合わせサブプロトコルがあります。 これにより、フロントエンドメッセージ種類にParse、Execute、Describe、Close、Flush、およびSyncが、バックエンドメッセージ種類にParseComplete、BindComplete、PortalSuspended、ParameterDescription、NoData、およびCloseCompleteが追加されました。 既存のクライアントは、このサブプロトコルを意識する必要はありませんが、これを使用することで、性能や機能を向上させることができます。

<command>COPY</command> data is now encapsulated into CopyData and CopyDone messages. There is a well-defined way to recover from errors during <command>COPY</command>. The special <quote><literal>\.</literal></quote> last line is not needed anymore, and is not sent during <command>COPY OUT</command>. (It is still recognized as a terminator during <command>COPY IN</command>, but its use is deprecated and will eventually be removed.) Binary <command>COPY</command> is supported. The CopyInResponse and CopyOutResponse messages include fields indicating the number of columns and the format of each column. COPYデータがCopyDataとCopyDoneメッセージにカプセル化されるようになりました。 COPY中のエラーから復旧するための十分に定義された方法があります。 特別な\.という最後の行はもはや不要で、COPY OUTで送信されません。 (COPY INではまだ終端として認識されます。しかし、この使用は廃止予定で、最終的には削除されます。) バイナリCOPYがサポートされます。 CopyInResponseとCopyOutResponseメッセージは、列数と各列の書式を示すフィールドが含まれます。

The layout of FunctionCall and FunctionCallResponse messages has changed. FunctionCall can now support passing NULL arguments to functions. It also can handle passing parameters and retrieving results in either text or binary format. There is no longer any reason to consider FunctionCall a potential security hole, since it does not offer direct access to internal server data representations. FunctionCallとFunctionCallResponseメッセージのレイアウトが変更されました。 FunctionCallは関数へのNULL引数を渡すことができるようになりました。 また、テキストとバイナリ書式のどちらでもパラメータの引き渡しと結果の取り出しを扱うことができます。 サーバの内部データ表現への直接アクセスを提供しなくなりましたので、FunctionCallを潜在的なセキュリティホールとみなす理由はもはやありません。

The backend sends ParameterStatus ('<literal>S</literal>') messages during connection startup for all parameters it considers interesting to the client library. Subsequently, a ParameterStatus message is sent whenever the active value changes for any of these parameters. バックエンドは、接続開始時にクライアントライブラリが興味を持つとみなされるすべてのパラメータのためにParameterStatus('S')メッセージを送信します。 その後、これらのパラメータのいずれかの実際の値が変更された時は常に、ParameterStatusメッセージが送信されます。

The RowDescription ('<literal>T</literal>') message carries new table OID and column number fields for each column of the described row. It also shows the format code for each column. RowDescription('T')メッセージは、新規に、記述する各列に対してテーブルのOIDと列番号フィールドを伝えます。 また各列の書式コードも示します。

The CursorResponse ('<literal>P</literal>') message is no longer generated by the backend. CursorResponse('P')メッセージはもはやバックエンドで生成されません。

The NotificationResponse ('<literal>A</literal>') message has an additional string field, which can carry a <quote>payload</quote> string passed from the <command>NOTIFY</command> event sender. NotificationResponse('A')メッセージは、NOTIFYイベントの送信者から渡されるペイロード文字列を伝えることができる追加文字列フィールドを持ちます。

The EmptyQueryResponse ('<literal>I</literal>') message used to include an empty string parameter; this has been removed. EmptyQueryResponse('I')メッセージは、空の文字列パラメータを含めるために使用されていました。 これは削除されました。