↑↓ 选择 ↵ 打开 ⌫ 改范围 完整检索页

pgsql.cc 提供对 postgresql.org 官网内容的中文翻译,由 Pigsty 团队维护。

百科 / psql 命令 / 查询缓冲区与编辑

\ef

这个命令获取并编辑指定函数或过程的定义,形式为 CREATE OR REPLACE FUNCTION 或 CREATE OR REPLACE PROCEDURE 命令。编辑方式与 \edit 相同。如果在不保存的情况下退出编辑器,则该语句会被丢弃。如果保存并退出编辑器,并在其中添加了分号,则更新后的命令会立即执行。否则它会重新显示;键入分号或 \g 发送它,或用 \r 取消。

当前查看 PostgreSQL 18.6。

说明

这个命令获取并编辑指定函数或过程的定义,形式为 CREATE OR REPLACE FUNCTION 或 CREATE OR REPLACE PROCEDURE 命令。编辑方式与 \edit 相同。如果在不保存的情况下退出编辑器,则该语句会被丢弃。如果保存并退出编辑器,并在其中添加了分号,则更新后的命令会立即执行。否则它会重新显示;键入分号或 \g 发送它,或用 \r 取消。

客户端
psql 18.6
区分大小写的写法
\ef

用法

\ef [ function_description [ line_number ] ]

本版手册中的写法

命令手册中的后缀修饰符
\ef此语法签名未列出

手册定义

\ef [ function_description [ line_number ] ]

这个命令获取并编辑指定函数或过程的定义,形式为CREATE OR REPLACE FUNCTION或 CREATE OR REPLACE PROCEDURE命令。编辑方式与\edit相同。如果在不保存的情况下退出编辑器,则该语句会被丢弃。如果保存并退出编辑器,并在其中添加了分号,则更新后的命令会立即执行。否则它会重新显示;键入分号或\g发送它,或用\r取消。

目标函数可仅用名称指定,也可用名称和参数指定,例如 foo(integer, text)。若有多个同名函数,则必须提供参数类型。

如果未指定函数,则会呈现一个空的CREATE FUNCTION模板供编辑。

如果指定了行号,psql将光标定位在函数体的指定行上。(请注意,函数体通常不会从文件的第一行开始。)

与大多数其他元命令不同,整个行的剩余部分始终被视为\ef的参数,参数中不进行变量插值或反引号扩展。

提示

关于如何配置和自定义编辑器,请参见下面的环境。

相关条目

文档与源码

来源构建
版本
18.6
构建
https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2
来源指纹
ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8

版本比较

PostgreSQL 10 → 11: 属性变化。

以下差异保留原始字段名与英文源描述。

--- PostgreSQL 10
+++ PostgreSQL 11
@@ -1,5 +1,5 @@
 {
-  "definition": "This command fetches and edits the definition of the named function, in the form of a CREATE OR REPLACE FUNCTION command. Editing is done in the same way as for \\edit . After the editor exits, the updated command waits in the query buffer; type semicolon or \\g to send it, or \\r to cancel. The target function can be specified by name alone, or by name and arguments, for example foo(integer, text) . The argument types must be given if there is more than one function of the same name. If no function is specified, a blank CREATE FUNCTION template is presented for editing. If a line number is specified, psql will position the cursor on the specified line of the function body. (Note that the function body typically does not begin on the first line of the file.) Unlike most other meta-commands, the entire remainder of the line is always taken to be the argument(s) of \\ef , and neither variable interpolation nor backquote expansion are performed in the arguments. Tip See under Environment for how to configure and customize your editor.",
+  "definition": "This command fetches and edits the definition of the named function or procedure, in the form of a CREATE OR REPLACE FUNCTION or CREATE OR REPLACE PROCEDURE command. Editing is done in the same way as for \\edit . After the editor exits, the updated command waits in the query buffer; type semicolon or \\g to send it, or \\r to cancel. The target function can be specified by name alone, or by name and arguments, for example foo(integer, text) . The argument types must be given if there is more than one function of the same name. If no function is specified, a blank CREATE FUNCTION template is presented for editing. If a line number is specified, psql will position the cursor on the specified line of the function body. (Note that the function body typically does not begin on the first line of the file.) Unlike most other meta-commands, the entire remainder of the line is always taken to be the argument(s) of \\ef , and neither variable interpolation nor backquote expansion are performed in the arguments. Tip See under Environment for how to configure and customize your editor.",
   "modifiers": [],
   "signature": "\\ef [ function_description [ line_number ] ]",
   "spellings": [

比较已记录的接口与属性,排除来源指纹和构建元数据。某个样本中没有记录,不能据此判断实际引入或移除的版本。

相关条目

导出 JSON · 返回psql 命令 · 收录范围为 PostgreSQL 10 至 20;最早采样版本不一定是实际引入版本。