我正在使用以下命令来描述Unix中的函数。
df+ functionName
问题:无法读取函数的说明。
有没有其他方法可以使用适当的缩进来查找函数。
如果你从键-E
(psql -E
)开始psql
并运行你的df+ functionName
,你会看到,它从pg_catalog.pg_proc
中获取定义,所以你可以像select prosrc from pg_proc where proname = 'functionName';'
sf functionName
也一样 - 这是pg_catalog.pg_get_functiondef
的总结.
最后,如果您按照自己的方式进行操作,使用df+
,只需在它之前运行x
,Source code
看起来会好得多。
无论如何,在所有这些情况下,缩进都被保存了:
b=# create function p() returns text
b-# as
b-# $$
b$# begin
b$# --tab
b$# --two spaces
b$# --three spaces
b$# return 't';
b$# end;
b$# $$ language plpgsql
b-# ;
CREATE FUNCTION
b=# x
Expanded display is on.
b=# df+ p
List of functions
-[ RECORD 1 ]-------+------------------
Schema | public
Name | p
Result data type | text
Argument data types |
Type | normal
Security | invoker
Volatility | volatile
Owner | postgres
Language | plpgsql
Source code | +
| begin +
| --tab +
| --two spaces +
| --three spaces+
| return 't'; +
| end; +
|
Description |
b=# sf p
CREATE OR REPLACE FUNCTION public.p()
RETURNS text
LANGUAGE plpgsql
AS $function$
begin
--tab
--two spaces
--three spaces
return 't';
end;
$function$