メッセージ形式

This section describes the detailed format of each message. Each can be sent by either a frontend (F), a postmaster/backend (B), or both (F & B).

この章ではそれぞれのメッセージの形式について記載します。それぞれはフロントエンド(F)、 postmaster とバックエンド(B)あるいは双方(F & B)から送出されます。

AsciiRow (B)

Byte1('D')

Identifies the message as an ASCII data row. (A prior RowDescription message defines the number of fields in the row and their data types.)

ASCII データ列でのメッセージを示します。 (先行する RowDescription メッセージで列の中のフィールド数とその データ型を定義します。)

Byten

A bit map with one bit for each field in the row. The 1st field corresponds to bit 7 (MSB) of the 1st byte, the 2nd field corresponds to bit 6 of the 1st byte, the 8th field corresponds to bit 0 (LSB) of the 1st byte, the 9th field corresponds to bit 7 of the 2nd byte, and so on. Each bit is set if the value of the corresponding field is not NULL. If the number of fields is not a multiple of 8, the remainder of the last byte in the bit map is wasted.

行の各フィールドに1ビットずつ対応するビットマップです。 第1フィールドは第1バイトのビット7(MSB)に対応し、第2フィールドは 第1バイトのビット6、第8フィールドは第1バイトのビット0(LSB)、第9 フィールドは第2バイトのビット7といった順で対応します。対応する フィールドの値が NULL で無い限りそれぞれのビットが立てられます。 もしもフィールド数が8の倍数でない場合には、ビット対応における最後 のバイトの余りは不要となります。

Then, for each field with a non-NULL value, there is the following:

値が NULL でないそれぞれのフィールドに対して次のものがあります。

Int32

Specifies the size of the value of the field, including this size.

このサイズを含めたフィールドの値の大きさを指定します。

Byten

Specifies the value of the field itself in ASCII characters. n is the above size minus 4. There is no trailing '\0' in the field data; the front end must add one if it wants one.

ASCII 文字でのフィールドの値そのものの指定 です。n は上記のサイズ引く4です。 フィールドデータの最後には '\0' が付いていません。必要なら フロントエンドが付加しなければなりません。

AuthenticationOk (B)

Byte1('R')

Identifies the message as an authentication request.

メッセージが認証リクエストであることを示します。

Int32(0)

Specifies that the authentication was successful.

認証が成功したことを指定します。

AuthenticationKerberosV4 (B)

Byte1('R')

Identifies the message as an authentication request.

メッセージが認証要求であることを示します。

Int32(1)

Specifies that Kerberos V4 authentication is required.

Kerberos V4 の認証が必要なことを指定します。

AuthenticationKerberosV5 (B)

Byte1('R')

Identifies the message as an authentication request.

メッセージが認証リクエストであること示します。

Int32(2)

Specifies that Kerberos V5 authentication is required.

Kerberos V5 の認証が必要なことを指定します。

AuthenticationUnencryptedPassword (B)

Byte1('R')

Identifies the message as an authentication request.

メッセージが認証要求であることを示します。

Int32(3)

Specifies that an unencrypted password is required.

暗号化されていないパスワードが必要なことを指定します。

AuthenticationEncryptedPassword (B)

Byte1('R')

Identifies the message as an authentication request.

メッセージが認証要求であることを示します。

Int32(4)

Specifies that an encrypted password is required.

暗号化されたパスワードが必要であることを指定します。

Byte2

The salt to use when encrypting the password.

パスワードを暗号化するときに使用するソルト。

BackendKeyData (B)

Byte1('K')

Identifies the message as cancellation key data. The frontend must save these values if it wishes to be able to issue CancelRequest messages later.

メッセージが取り消しの鍵データであることを示します。フロン トエンドは後で CancelRequest メッセージを出すのであればこれ らの値を保存しておかなければなりません。

Int32

The process ID of this backend.

このバックエンドのプロセス ID。

Int32

The secret key of this backend.

このバックエンドの秘密鍵。

BinaryRow (B)

Byte1('B')

Identifies the message as a binary data row. (A prior RowDescription message defines the number of fields in the row and their data types.)

メッセージがバイナリデータ列であることを示します。 (先行する RowDescription メッセージで列の中のフィールド数 とそのデータ型を定義します。)

Byten

A bit map with one bit for each field in the row. The 1st field corresponds to bit 7 (MSB) of the 1st byte, the 2nd field corresponds to bit 6 of the 1st byte, the 8th field corresponds to bit 0 (LSB) of the 1st byte, the 9th field corresponds to bit 7 of the 2nd byte, and so on. Each bit is set if the value of the corresponding field is not NULL. If the number of fields is not a multiple of 8, the remainder of the last byte in the bit map is wasted.

行の各フィールドに1ビットずつ対応するビットマップです。 第1フィールドは第1バイトのビット7(MSB)に対応し、第2フィールド は第1バイトのビット6、第8フィールドは第1バイトのビット0(LSB)、 第9フィールドは第2バイトのビット7といった順で対応します。 対応するフィールドの値が NULL で無い限りそれぞれのビットが立て られます。もしフィールド数が8の倍数でない場合には、ビット対応に おける最後のバイトの余りは不要となります。

Then, for each field with a non-NULL value, there is the following:

値が NULL でないそれぞれのフィールドに対して以下があります。

Int32

Specifies the size of the value of the field, excluding this size.

このサイズを含めないフィールドの値の大きさを指定します。

Byten

Specifies the value of the field itself in binary format. n is the above size.

バイナリ形式でのフィールドの値そのものを指定します。 n は上記のサイズです。

CancelRequest (F)

Int32(16)

The size of the packet in bytes.

バイト数によるパケットのサイズ。

Int32(80877102)

The cancel request code. The value is chosen to contain "1234" in the most significant 16 bits, and "5678" in the least 16 significant bits. (To avoid confusion, this code must not be the same as any protocol version number.)

取り消し要求のコード。この値は最上位16ビットに 「1234」を、また 最下位16ビットに 「5678」を含むように選ばれます。(混乱を避けるた め、このコードは他のプロトコルバージョンとは同一でありません。)

Int32

The process ID of the target backend.

目的とするバックエンドのプロセス ID。

Int32

The secret key for the target backend.

目的とするバックエンドの秘密鍵。

CompletedResponse (B)

Byte1('C')

Identifies the message as a completed response.

メッセージが完了した回答であることを示します。

String

The command tag. This is usually (but not always) a single word that identifies which SQL command was completed.

コマンドタグ。これは通常(常にではありません)どの SQL 命令が 完了したかを示す1単語です。

CopyDataRows (B & F)

This is a stream of rows where each row is terminated by a Byte1('\n'). This is then followed by the sequence Byte1('\\'), Byte1('.'), Byte1('\n').

連続する行データで、各行は Byte1('\n') で終ります。全てのデータの一番 最後には Byte1('\\')、Byte1('.')、Byte1('\n') というシーケンスが来ます。

CopyInResponse (B)

Byte1('G')

Identifies the message as a Start Copy In response. The frontend must now send a CopyDataRows message.

メッセージが「コピーインの開始」であることを示します。 このコマンドには、さらに CopyDataRows メッセージが続きます。

CopyOutResponse (B)

Byte1('H')

Identifies the message as a Start Copy Out response. This message will be followed by a CopyDataRows message.

メッセージが「コピーアウトの開始」であることを示します。 このコマンドには、さらに CopyDataRows メッセージが続きます。

CursorResponse (B)

Byte1('P')

Identifies the message as a cursor response.

メッセージがカーソル回答であることを示します。

String

The name of the cursor. This will be "blank" if the cursor is implicit.

カーソルの名称。カーソル名を明示的に指定しなかった場合、これは 「blank」という文字列になります。

EmptyQueryResponse (B)

Byte1('I')

Identifies the message as a response to an empty query string.

メッセージが空の問い合わせ文字列の回答であることを示します。

String("")

Unused.

未使用。

EncryptedPasswordPacket (F)

Int32

The size of the packet in bytes.

バイト数によるパケットのサイズ。

String

The encrypted (using crypt()) password.

(crypt() を使用した)暗号化されたパスワード。

ErrorResponse (B)

Byte1('E')

Identifies the message as an error.

エラーのメッセージを示します。

String

The error message itself.

エラーメッセージそのもの。

FunctionCall (F)

Byte1('F')

Identifies the message as a function call.

メッセージが関数呼び出しであることを示します。

String("")

Unused.

未使用。

Int32

Specifies the object ID of the function to call.

呼び出す関数のオブジェクト ID を指定します。

Int32

Specifies the number of arguments being supplied to the function.

関数に渡される引数の数を指定します。

Then, for each argument, there is the following:

それぞれの引数に対して以下のものがあります。

Int32

Specifies the size of the value of the argument, excluding this size.

このサイズを除いた引数の値のサイズの指定。

Byten

Specifies the value of the field itself in binary format. n is the above size.

バイナリ形式でのフィールドそのものの値を指定します。 n は上記のサイズです。

FunctionResultResponse (B)

Byte1('V')

Identifies the message as a function call result.

メッセージが関数呼び出しの結果であることを示します。

Byte1('G')

Specifies that a nonempty result was returned.

空でない結果が返されたことを指定します。

Int32

Specifies the size of the value of the result, excluding this size.

このサイズを除いた結果の値のサイズを指定します。

Byten

Specifies the value of the result itself in binary format. n is the above size.

バイナリ形式で結果の値そのものを指定します。 n は上記のサイズです。

Byte1('0')

Unused. (Strictly speaking, FunctionResultResponse and FunctionVoidResponse are the same thing but with some optional parts to the message.)

未使用。(厳密に言うと、FunctionResultResponse と FunctionVoidResponse は同一のものですが、メッセージに対していくつかの選択部分があります。)

FunctionVoidResponse (B)

Byte1('V')

Identifies the message as a function call result.

メッセージが関数呼び出しの結果であることを示します。

Byte1('0')

Specifies that an empty result was returned.

空の結果が返されたことを指定します。

NoticeResponse (B)

Byte1('N')

Identifies the message as a notice.

メッセージが通知であることを示します。

String

The notice message itself.

通知メッセージそのものです。

NotificationResponse (B)

Byte1('A')

Identifies the message as a notification response.

メッセージが通知に関する回答であることを示します。

Int32

The process ID of the notifying backend process.

バックエンドプロセスを通知するプロセス ID。

String

The name of the condition that the notify has been raised on.

通知が出された状況の名称。

Query (F)

Byte1('Q')

Identifies the message as a query.

メッセージが問い合わせであることを示します。

String

The query string itself.

問い合わせ文字列そのもの。

ReadyForQuery (B)

Byte1('Z')

Identifies the message type. ReadyForQuery is sent whenever the backend is ready for a new query cycle.

メッセージの型を示します。バックエンドが新規の問い合わせ サイクルに入れる場合 ReadyForQuery が送られます。

RowDescription (B)

Byte1('T')

Identifies the message as a row description.

メッセージが行の解説であることを示します。

Int16

Specifies the number of fields in a row (may be zero).

行のフィールド数(零の場合もある)を指定します。

Then, for each field, there is the following:

それぞれのフィールドに対し以下があります。

String

Specifies the field name.

フィールドの名称を指定します。

Int32

Specifies the object ID of the field type.

フィールドの型のオブジェクト ID を指定します。

Int16

Specifies the type size.

型のサイズを指定します。

Int32

Specifies the type modifier.

修飾子の型を指定します。

StartupPacket (F)

Int32(296)

The size of the packet in bytes.

バイトでのパケットのサイズ。

Int32

The protocol version number. The most significant 16 bits are the major version number. The least 16 significant bits are the minor version number.

プロトコルのバージョン番号。最上位16ビットはメジャーバージョン 番号です。最下位16ビットはマイナーバージョン番号を表します。

LimString64

The database name, defaults to the user name if empty.

データベースの名前で、空であればユーザ名がデフォルトになります。

LimString32

The user name.

ユーザ名。

LimString64

Any additional command line arguments to be passed to the backend by the postmaster.

postmaster からバックエンドに渡される任意の追加のコマンド ライン引数。

LimString64

Unused.

LimString64

The optional tty the backend should use for debugging messages.

バックエンドがメッセージのバグ取りに使用すべき任意の tty。

Terminate (F)

Byte1('X')

Identifies the message as a termination.

メッセージが終了であることを示します。

UnencryptedPasswordPacket (F)

Int32

The size of the packet in bytes.

バイト数によるパケットのサイズ。

String

The unencrypted password.

暗号化されていないパスワード。