Postgres packets

All communication between Postgres clients and servers are through discrete packets. Some packet types can be sent by the client to the server, others by the server to the client, and a few can be sent from either side.

For full details, consult the Postgres documentation.

Request packets

Bind : binds a prepared statement to a set of parameter values

CancelRequest : sent to request the cancellation of an ongoing query

Close : closes a prepared statement or cursor/portal

Describe : asks for the description of a prepared statement or cursor/portal

Execute : requests the execution of a given portal/cursor

Flush : asks the server to send any remaining data

FunctionCall : asks the server to execute the specified function

Parse : asks the server to set up a prepared statement

Query : execute a SQL command or query directly

StartupMessage: the first packet sent by the database client, includes the user name but no credentials.

Sync : asks the server to send any remaining or buffered data

Terminate : notify the server that the client is about to disconnect

Response packets

AuthenticationRequest : sent by the server to challenge the client for authentication

BackendKeyData : contains information to cancel a request

BindComplete : indicates that a Bind command has completed successfully

CloseComplete : indicates that a Close command has completed successfuly

CommandComplete : sent after a command or query has finished executing

DataRow : represents one row in a result set

DataRowBatch : one or more rows in a result set

EmptyQueryResponse : sent when a query has no results

ErrorResponse : sent when the server has encountered an error

FunctionCallResponse : returns the result of a function call

NegociateProtocolVersion ; sent when the server requests a different protocol version, or to signal it cannot support certain options

NoData : sent by the server to indicate that a prepared statement will not return any rows

NoticeResponse : notifies the client of non-fatal warnings

NotificationResponse : used for asynchronous operations

ParameterDescription : returns the data types of the parameters required for a prepared statement

ParameterStatus : notifies the client that a system parameter has a new value

ParseComplete : indicates that a prepared statement is ready

PortalSuspended : indicates incomplete execution of a prepared statement

ReadyForQuery : indicates that the server is ready for the next request

RowDescription : describes the makeup of a result set


All filters can expect the following variables to be defined:

  • context.packet: the current packet

  • context.connectionContext: the context for the current database connection

  • context.connectionContext.userName: the name of the current database user (only available after login)

  • context.connectionContext.databaseName: the name of the default database currently in use

  • context.connectionContext.currentQuery: the last SQL command to be sent to the server

  • context.connectionContext.clientIP: the IP address of the database client as a string, can be either IP4 or IP6