Skip to content

Postgres frontend–backend protocol messages

Pavel Lang edited this page Nov 23, 2017 · 5 revisions

This table was extracted from https://www.postgresql.org/docs/devel/static/protocol-message-formats.html

Chr Message name Who issue Bind command.
B Bind F Bind command.
C Close F Close command.
f CopyFail F COPY-failure indicator.
D Describe F Describe command.
E Execute F Execute command.
H Flush F Flush command.
F FunctionCall F function call.
p GSSResponse F GSSAPI or SSPI response. Note that this is also used for SASL and password response messages. The exact message type can be deduced from the context.
P Parse F Parse command.
p PasswordMessage F password response. Note that this is also used for GSSAPI, SSPI and SASL response messages. The exact message type can be deduced from the context.
Q Query F simple query.
p SASLInitialResponse F initial SASL response. Note that this is also used for GSSAPI, SSPI and password response messages. The exact message type is deduced from the context.
p SASLResponse F SASL response. Note that this is also used for GSSAPI, SSPI and password response messages. The exact message type can be deduced from the context.
S Sync F Sync command.
X Terminate F termination.
d CopyData F&B COPY data.
c CopyDone F&B COPY-complete indicator.
R AuthenticationOk B authentication request.
R AuthenticationKerberosV5 B authentication request.
R AuthenticationCleartextPassword B authentication request.
R AuthenticationMD5Password B authentication request.
R AuthenticationSCMCredential B authentication request.
R AuthenticationGSS B authentication request.
R AuthenticationSSPI B authentication request.
R AuthenticationGSSContinue B authentication request.
R AuthenticationSASL B authentication request.
R AuthenticationSASLContinue B authentication request.
R AuthenticationSASLFinal B authentication request.
K BackendKeyData B cancellation key data. The frontend must save these values if it wishes to be able to issue CancelRequest messages later.
2 BindComplete B Bind-complete indicator.
3 CloseComplete B Close-complete indicator.
C CommandComplete B command-completed response.
G CopyInResponse B Start Copy In response. The frontend must now send copy-in data (if not prepared to do so, send a CopyFail message).
H CopyOutResponse B Start Copy Out response. This message will be followed by copy-out data.
W CopyBothResponse B Start Copy Both response. This message is used only for Streaming Replication.
D DataRow B data row.
I EmptyQueryResponse B response to an empty query string. (This substitutes for CommandComplete.)
E ErrorResponse B error.
V FunctionCallResponse B function call result.
v NegotiateProtocolVersion B protocol version negotiation message.
n NoData B no-data indicator.
N NoticeResponse B notice.
A NotificationResponse B notification response.
t ParameterDescription B parameter description.
S ParameterStatus B run-time parameter status report.
1 ParseComplete B Parse-complete indicator.
s PortalSuspended B portal-suspended indicator. Note this only appears if an Execute message's row-count limit was reached.
Z ReadyForQuery B ReadyForQuery is sent whenever the backend is ready for a new query cycle.
T RowDescription B row description.

Special messages

CancelRequest (F) Int32(16) Length of message contents in bytes, including self.

SSLRequest (F) Int32(8) Length of message contents in bytes, including self.

StartupMessage (F) Int32 Length of message contents in bytes, including self.

Clone this wiki locally