TupleData (logical replication)
逻辑复制 TupleData 格式:列数。
当前查看 PostgreSQL 18.6。
说明
逻辑复制 TupleData 格式:列数。
- 层次
- 逻辑复制载荷,与前后端消息封装分开。
- 首个字段
- Int16
用法
TupleData协议上下文
本节说明各逻辑复制消息的详细格式。这些消息由复制槽 SQL 接口返回,或由 walsender 发送。由 walsender 发送时,它们被封装在复制协议的 WAL 消息中(参见第 54.4 节),消息流程通常与物理复制相同。Stream Start、Stream Stop、Stream Commit 和 Stream Abort 从协议版本 2 起可用。Begin Prepare、Prepare、Commit Prepared、Rollback Prepared 和 Stream Prepare 从协议版本 3 起可用。以下消息部分为上述消息所共用。
按手册顺序排列的字段
| 位置 | 格式 | 含义 |
|---|---|---|
| 1 | Int16 | 列数。 |
| 2 | Byte1('n') | 将该数据标识为 NULL 值。 |
| 3 | Byte1('u') | 标识经过 TOAST 处理且未更改的值(不发送实际值)。 |
| 4 | Byte1('t') | 将该数据标识为文本格式的值。 |
| 5 | Byte1('b') | 将该数据标识为二进制格式的值。 |
| 6 | Int32 | 列值的长度。 |
| 7 | Byte n | 列值,采用二进制或文本格式(由前面的格式字节指定)。 n 为上述长度。 |
手册定义
-
- Int16
-
列数。
接下来,每个已发布的列都会出现以下子消息之一:
- Byte1('n')
-
将该数据标识为 NULL 值。
或者
- Byte1('u')
-
标识经过 TOAST 处理且未更改的值(不发送实际值)。
或者
- Byte1('t')
-
将该数据标识为文本格式的值。
或者
- Byte1('b')
-
将该数据标识为二进制格式的值。
- Int32
-
列值的长度。
- Byte n
-
列值,采用二进制或文本格式(由前面的格式字节指定)。
n为上述长度。
相关条目
文档与源码
来源构建
- 版本
- 18.6
- 构建
- https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2
- 来源指纹
555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f
版本比较
PostgreSQL 13 → 14: 属性变化。
以下差异保留原始字段名与英文源描述。
--- PostgreSQL 13
+++ PostgreSQL 14
@@ -17,11 +17,15 @@
"format": "Byte1('t')"
},
{
+ "description": "Identifies the data as binary formatted value.",
+ "format": "Byte1('b')"
+ },
+ {
"description": "Length of the column value.",
"format": "Int32"
},
{
- "description": "The value of the column, in text format. (A future release might support additional formats.) n is the above length.",
+ "description": "The value of the column, either in binary or in text format. (As specified in the preceding format byte). n is the above length.",
"format": "Byte n"
}
],
比较已记录的接口与属性,排除来源指纹和构建元数据。某个样本中没有记录,不能据此判断实际引入或移除的版本。
相关条目
Begin (logical replication)Begin Prepare (logical replication)Commit (logical replication)Commit Prepared (logical replication)Delete (logical replication)Insert (logical replication)Message (logical replication)Origin (logical replication)Prepare (logical replication)Relation (logical replication)Rollback Prepared (logical replication)Stream Abort (logical replication)
导出 JSON · 返回协议消息 · 收录范围为 PostgreSQL 10 至 20;最早采样版本不一定是实际引入版本。