↑↓ 选择↵ 打开⌫ 切换范围完整搜索

PG.CENTER 连接 PostgreSQL 文档、百科与生态知识。由 Pigsty 维护。

Wiki / 协议消息

BackendKeyData

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

当前阅读 PG 18·选择有来源记录的版本

此版本暂无所选语言的定义,以下显示原始英文内容。

Direction
Backend → frontend
First wire field
Byte1('K')
Field entries
4
Documented flow contexts
Start-up
direction
B
manual path
/docs/18/protocol-message-formats.html
signature
BackendKeyData (B)

版本定义 PG 18

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.

Int32

Length of message contents in bytes, including self.

Int32

The process ID of this backend.

Byten

The secret key of this backend. This field extends to the end of the message, indicated by the length field.

The minimum and maximum key length are 4 and 256 bytes, respectively. The PostgreSQL server only sends keys up to 32 bytes, but the larger maximum size allows for future server versions, as well as connection poolers and other middleware, to use longer keys. One possible use case is augmenting the server's key with extra information. Middleware is therefore also encouraged to not use up all of the bytes, in case multiple middleware applications are layered on top of each other, each of which may wrap the key with extra data.

Before protocol version 3.2, the secret key was always 4 bytes long.

Wire fields in documented order

PositionFormatMeaning
1Byte1('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.
2Int32Length of message contents in bytes, including self.
3Int32The process ID of this backend.
4Byte nThe secret key of this backend. This field extends to the end of the message, indicated by the length field. The minimum and maximum key length are 4 and 256 bytes, respectively. The PostgreSQL server only sends keys up to 32 bytes, but the larger maximum size allows for future server versions, as well as connection poolers and other middleware, to use longer keys. One possible use case is augmenting the server's key with extra information. Middleware is therefore also encouraged to not use up all of the bytes, in case multiple middleware applications are layered on top of each other, each of which may wrap the key with extra data.

比较版本

完整来源事实

fields

map[description:Identifies the message as cancellation key data. The frontend must save these values if it wishes to be able to issue CancelRequest messages later. format:Byte1('K')], map[description:Length of message contents in bytes, including self. format:Int32], map[description:The process ID of this backend. format:Int32], map[description:The secret key of this backend. This field extends to the end of the message, indicated by the length field. The minimum and maximum key length are 4 and 256 bytes, respectively. The PostgreSQL server only sends keys up to 32 bytes, but the larger maximum size allows for future server versions, as well as connection poolers and other middleware, to use longer keys. One possible use case is augmenting the server's key with extra information. Middleware is therefore also encouraged to not use up all of the bytes, in case multiple middleware applications are layered on top of each other, each of which may wrap the key with extra data. format:Byte n]

来源引用

完整定义与证据 JSON

定义来源

center · PostgreSQL 18 · 555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f

正文语言: en · 555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f