| PostgreSQL | ||
|---|---|---|
| Prev | Chapter 50. Frontend/Backend Protocol | Next |
Message Formats
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).
- AsciiRow (B)
- Byte1('D')
Identifies the message, in the context in which it is sent (see CopyInResponse), as an ASCII row.
- Byten
A bit map with one bit for each field in the row. The 1st field corresponds to bit 7 of the 1st byte, the 2nd field corresponds to bit 6 of the 1st byte, the 8th field corresponds to bit 0 of the 1st byte, the 9th field corresponds to bit 8 of the 2nd byte, and so on. The bit is set if the value of the corresponding field is not NULL.
Then, for each field, there is the following:
- 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.
- 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.
- AuthenticationKerberosV5 (B)
- Byte1('R')
Identifies the message as an authentication request.
- Int32(2)
Specifies that Kerberos V5 authentication is required.
- 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.
- BinaryRow (B)
- Byte1('B')
Identifies the message, in the context in which it is sent (see CopyOutResponse), as a binary row.
- Byten
A bit map with one bit for each field in the row. The 1st field corresponds to bit 7 of the 1st byte, the 2nd field corresponds to bit 6 of the 1st byte, the 8th field corresponds to bit 0 of the 1st byte, the 9th field corresponds to bit 8 of the 2nd byte, and so on. The bit is set if the value of the corresponding field is not NULL.
Then, for each field, there is the following:
- 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.
- 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.
- CopyDataRows (B & F)
This is a stream of rows where each row is terminated by a Char1('\n'). This is then followed by the sequence Char1('\\'), Char1('.'), Char1('\n').
- CopyInResponse (B)
- Byte1('D')
Identifies the message, in the context in which it is sent (see AsciiRow), as a copy in started response.
- CopyOutResponse (B)
- Byte1('B')
Identifies the message, in the context in which it is sent (see BinaryRow), as a copy out started response.
- 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.
- EmptyQueryResponse (B)
- Byte1('I')
Identifies the message as an empty query response.
- String("")
Unused.
- EncryptedPasswordPacket (F)
- Int32
The size of the packet in bytes.
- String
The encrypted (using crypt()) password.
- 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.
- 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.
- FunctionResultResponse (B)
- Byte1('V')
Identifies the message as a function call result.
- Byte1('G')
Specifies that an actual 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.
- Byte1('0')
Unused. (Strictly speaking, FunctionResultResponse and FunctionVoidResponse are the same thing but with some optional parts to the message.)
- FunctionVoidResponse (B)
- Byte1('V')
Identifies the message as a function call result.
- Byte1('0')
Specifies that no actual 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 backend process.
- String
The name of the relation that the notify has been raised on.
- Query (F)
- Byte1('Q')
Identifies the message as query.
- String
The query itself.
- RowDescription (B)
- Byte1('T')
Identifies the message as a row description.
- Int16
Specifies the number of fields in a row (and 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.
- Int16
Specifies the type size.
- 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.
- LimString64
The database name, defaults to the user name if omitted.
- LimString32
The user name.
- LimString64
Any additional command line arguments to be passed to the backend by the postmaster.
- LimString64
Unused.
- LimString64
The optional tty the backend should use for debugging messages.
- Terminate (F)
- Byte1('X')
Identifies the message as a termination.
- UnencryptedPasswordPacket (F)
- Int32
The size of the packet in bytes.
- String
The unencrypted password.
| Prev | Home | Next |
| Message Data Types | Up | GCC Default Optimizations |
Report a documentation issue
Read the upstream documentation. For corrections, first check the current manual.