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

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

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

\sf

这个命令获取并显示指定函数或过程的定义,以 CREATE OR REPLACE FUNCTION 或 CREATE OR REPLACE PROCEDURE 命令的形式呈现。定义将打印到当前查询输出通道,由 \o 设置。

当前查看 PostgreSQL 18.6。

说明

这个命令获取并显示指定函数或过程的定义,以 CREATE OR REPLACE FUNCTION 或 CREATE OR REPLACE PROCEDURE 命令的形式呈现。定义将打印到当前查询输出通道,由 \o 设置。

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

用法

\sf[+] function_description

本版手册中的写法

命令手册中的后缀修饰符
\sf+

手册定义

\sf[+] function_description

这个命令获取并显示指定函数或过程的定义,以CREATE OR REPLACE FUNCTION或 CREATE OR REPLACE PROCEDURE命令的形式呈现。定义将打印到当前查询输出通道,由\o设置。

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

在命令名后添加 +,会为输出行编号,函数体第一行为第 1 行。

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

相关条目

文档与源码

来源构建
版本
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 shows the definition of the named function, in the form of a CREATE OR REPLACE FUNCTION command. The definition is printed to the current query output channel, as set by \\o . 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 + is appended to the command name, then the output lines are numbered, with the first line of the function body being line 1. Unlike most other meta-commands, the entire remainder of the line is always taken to be the argument(s) of \\sf , and neither variable interpolation nor backquote expansion are performed in the arguments.",
+  "definition": "This command fetches and shows the definition of the named function or procedure, in the form of a CREATE OR REPLACE FUNCTION or CREATE OR REPLACE PROCEDURE command. The definition is printed to the current query output channel, as set by \\o . 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 + is appended to the command name, then the output lines are numbered, with the first line of the function body being line 1. Unlike most other meta-commands, the entire remainder of the line is always taken to be the argument(s) of \\sf , and neither variable interpolation nor backquote expansion are performed in the arguments.",
   "modifiers": [
     {
       "command": "\\sf",

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

相关条目

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