\syncpipeline
这组命令实现 SQL 语句的管道化。一个管道必须以 \startpipeline 开始,并以 \endpipeline 结束。其间可以出现任意数量的 \syncpipeline 命令,它会发送一条 同步消息 ,而不会结束当前管道,也不会刷新发送缓冲区。在管道模式下,语句会被发送到服务器,而不等待前面语句的结果。更多细节见 第 32.5 节 。
当前查看 PostgreSQL 18.6。
说明
这组命令实现 SQL 语句的管道化。一个管道必须以 \startpipeline 开始,并以 \endpipeline 结束。其间可以出现任意数量的 \syncpipeline 命令,它会发送一条 同步消息 ,而不会结束当前管道,也不会刷新发送缓冲区。在管道模式下,语句会被发送到服务器,而不等待前面语句的结果。更多细节见 第 32.5 节 。
- 客户端
- psql 18.6
- 区分大小写的写法
- \syncpipeline
用法
\startpipeline \sendpipeline \syncpipeline \endpipeline \flushrequest \flush \getresults [ number_results ]本版手册中的写法
| 命令 | 手册中的后缀修饰符 |
|---|---|
| \startpipeline | 此语法签名未列出 |
| \sendpipeline | 此语法签名未列出 |
| \syncpipeline | 此语法签名未列出 |
| \endpipeline | 此语法签名未列出 |
| \flushrequest | 此语法签名未列出 |
| \flush | 此语法签名未列出 |
| \getresults | 此语法签名未列出 |
手册定义
\startpipeline\sendpipeline\syncpipeline\endpipeline\flushrequest\flush\getresults [number_results]-
这组命令实现 SQL 语句的管道化。一个管道必须以
\startpipeline开始,并以\endpipeline结束。其间可以出现任意数量的\syncpipeline命令,它会发送一条同步消息,而不会结束当前管道,也不会刷新发送缓冲区。在管道模式下,语句会被发送到服务器,而不等待前面语句的结果。更多细节见第 32.5 节。管道进行期间执行的所有查询都使用扩展查询协议。以分号结束的查询会被追加到管道中。元命令
\bind、\bind_named、\close_prepared和\parse可以在进行中的管道里使用。管道进行期间,\sendpipeline会将当前查询缓冲区追加到管道中。其他元命令,如\g、\gx或\gdesc,则不允许在管道模式中使用。\flushrequest会向管道追加一条 flush 命令,使得可以在不发送 sync 或结束管道的情况下通过\getresults读取结果。\getresults会自动将尚未发送的数据推送到服务器。\flush可用于手动推送未发送的数据。\getresults接受一个可选的number_results参数。如果提供,则只读取前number_results个待处理结果。若省略该参数或其值为0,则读取所有待处理结果。当管道模式处于活动状态时,可使用一个专用的提示符变量来报告管道状态。详见
%P。COPY在管道模式中不支持。示例:
\startpipeline SELECT * FROM pg_class; SELECT 1 \bind \sendpipeline \flushrequest \getresults \endpipeline
相关条目
文档与源码
来源构建
- 版本
- 18.6
- 构建
- https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2
- 来源指纹
ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8
版本比较
PostgreSQL 17 → 18: 新增收录。
以下差异保留原始字段名与英文源描述。
--- PostgreSQL 17
+++ PostgreSQL 18
@@ -1 +1,14 @@
-该版未收录
+{
+ "definition": "This group of commands implements pipelining of SQL statements. A pipeline must begin with a \\startpipeline and end with an \\endpipeline . In between there may be any number of \\syncpipeline commands, which sends a sync message without ending the ongoing pipeline and flushing the send buffer. In pipeline mode, statements are sent to the server without waiting for the results of previous statements. See Section 32.5 for more details. All queries executed while a pipeline is ongoing use the extended query protocol. Queries are appended to the pipeline when ending with a semicolon. The meta-commands \\bind , \\bind_named , \\close_prepared or \\parse can be used in an ongoing pipeline. While a pipeline is ongoing, \\sendpipeline will append the current query buffer to the pipeline. Other meta-commands like \\g , \\gx or \\gdesc are not allowed in pipeline mode. \\flushrequest appends a flush command to the pipeline, allowing to read results with \\getresults without issuing a sync or ending the pipeline. \\getresults will automatically push unsent data to the server. \\flush can be used to manually push unsent data. \\getresults accepts an optional number_results parameter. If provided, only the first number_results pending results will be read. If not provided or 0 , all pending results are read. When pipeline mode is active, a dedicated prompt variable is available to report the pipeline status. See %P for more details COPY is not supported while in pipeline mode. Example: \\startpipeline SELECT * FROM pg_class; SELECT 1 \\bind \\sendpipeline \\flushrequest \\getresults \\endpipeline",
+ "modifiers": [],
+ "signature": "\\startpipeline \\sendpipeline \\syncpipeline \\endpipeline \\flushrequest \\flush \\getresults [ number_results ]",
+ "spellings": [
+ "\\startpipeline",
+ "\\sendpipeline",
+ "\\syncpipeline",
+ "\\endpipeline",
+ "\\flushrequest",
+ "\\flush",
+ "\\getresults"
+ ]
+}
比较已记录的接口与属性,排除来源指纹和构建元数据。某个样本中没有记录,不能据此判断实际引入或移除的版本。
相关条目
导出 JSON · 返回psql 命令 · 收录范围为 PostgreSQL 18 至 20;最早采样版本不一定是实际引入版本。