\;
反斜线分号不像前面的命令那样是一个元命令;相反,它只是在不进行进一步处理的情况下将一个分号添加到查询缓冲区中。
当前查看 PostgreSQL 18.6。
说明
反斜线分号不像前面的命令那样是一个元命令;相反,它只是在不进行进一步处理的情况下将一个分号添加到查询缓冲区中。
- 客户端
- psql 18.6
- 区分大小写的写法
- \;
用法
\;本版手册中的写法
| 命令 | 手册中的后缀修饰符 |
|---|---|
| \; | 此语法签名未列出 |
手册定义
\;-
反斜线分号不像前面的命令那样是一个元命令;相反,它只是在不进行进一步处理的情况下将一个分号添加到查询缓冲区中。
通常,psql会在到达命令结束的分号时立即将SQL命令发送到服务器,即使当前行还有更多输入。因此,例如输入
select 1; select 2; select 3;
将导致三个SQL命令分别发送到服务器,每个命令的结果在继续下一个命令之前显示。然而,输入为
\;的分号不会触发命令处理,因此它之前和之后的命令实际上被合并并作为一个请求发送到服务器。因此,例如select 1\; select 2\; select 3;
会在遇到前面没有反斜线的分号时,将这三个 SQL 命令作为单个请求发送到服务器。服务器会将此类请求作为单个事务执行,除非字符串中包含显式的
BEGIN/COMMIT命令将其分成多个事务。(有关服务器如何处理多查询字符串的更多详细信息,请参见第 54.2.2.1 节。)
相关条目
文档与源码
来源构建
- 版本
- 18.6
- 构建
- https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2
- 来源指纹
ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8
版本比较
PostgreSQL 17 → 18: 属性变化。
以下差异保留原始字段名与英文源描述。
--- PostgreSQL 17
+++ PostgreSQL 18
@@ -1,5 +1,5 @@
{
- "definition": "Backslash-semicolon is not a meta-command in the same way as the preceding commands; rather, it simply causes a semicolon to be added to the query buffer without any further processing. Normally, psql will dispatch an SQL command to the server as soon as it reaches the command-ending semicolon, even if more input remains on the current line. Thus for example entering select 1; select 2; select 3; will result in the three SQL commands being individually sent to the server, with each one's results being displayed before continuing to the next command. However, a semicolon entered as \\; will not trigger command processing, so that the command before it and the one after are effectively combined and sent to the server in one request. So for example select 1\\; select 2\\; select 3; results in sending the three SQL commands to the server in a single request, when the non-backslashed semicolon is reached. The server executes such a request as a single transaction, unless there are explicit BEGIN / COMMIT commands included in the string to divide it into multiple transactions. (See Section 53.2.2.1 for more details about how the server handles multi-query strings.)",
+ "definition": "Backslash-semicolon is not a meta-command in the same way as the preceding commands; rather, it simply causes a semicolon to be added to the query buffer without any further processing. Normally, psql will dispatch an SQL command to the server as soon as it reaches the command-ending semicolon, even if more input remains on the current line. Thus for example entering select 1; select 2; select 3; will result in the three SQL commands being individually sent to the server, with each one's results being displayed before continuing to the next command. However, a semicolon entered as \\; will not trigger command processing, so that the command before it and the one after are effectively combined and sent to the server in one request. So for example select 1\\; select 2\\; select 3; results in sending the three SQL commands to the server in a single request, when the non-backslashed semicolon is reached. The server executes such a request as a single transaction, unless there are explicit BEGIN / COMMIT commands included in the string to divide it into multiple transactions. (See Section 54.2.2.1 for more details about how the server handles multi-query strings.)",
"modifiers": [],
"signature": "\\;",
"spellings": [
比较已记录的接口与属性,排除来源指纹和构建元数据。某个样本中没有记录,不能据此判断实际引入或移除的版本。
相关条目
导出 JSON · 返回psql 命令 · 收录范围为 PostgreSQL 11 至 20;最早采样版本不一定是实际引入版本。