Skip to main content

Module protocol

Module protocol 

Source
Expand description

PostgreSQL wire protocol implementation.

PostgreSQL uses a simple message format with a type byte and length prefix. This module provides encoding/decoding for all frontend and backend messages.

§Message Format

§Standard Message (after startup)

+------+--------+------------------+
| Type | Length | Payload          |
| 1B   | 4B     | (Length-4) bytes |
+------+--------+------------------+

Length includes itself (4 bytes) but not the type byte.

§Startup Message (first message from client)

+--------+------------------+
| Length | Payload          |
| 4B     | (Length-4) bytes |
+--------+------------------+

No type byte for startup message.

Modules§

auth_type
Authentication method codes from the server.
backend_type
Message type bytes for backend messages.
frontend_type
Message type bytes for frontend messages.

Structs§

ErrorFields
Error and notice response fields.
FieldDescription
Describes a single field (column) in a row description.
MessageReader
Incremental reader for PostgreSQL backend messages.
MessageWriter
Buffer for writing PostgreSQL protocol messages.

Enums§

BackendMessage
Messages sent from the PostgreSQL server to the client.
DescribeKind
Kind for Describe/Close messages
FrontendMessage
Messages sent from the client to the PostgreSQL server.
TransactionStatus
Transaction status indicator from ReadyForQuery

Constants§

CANCEL_REQUEST_CODE
Cancel request code.
PROTOCOL_VERSION
Protocol version 3.0.
SSL_REQUEST_CODE
SSL request code.