diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2023-03-02 17:15:00 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2023-03-02 17:15:13 -0500 |
commit | 3dfae91f7a1293e0a57526edcfca8690c176c681 (patch) | |
tree | 3b48438aa8c2d0f80860697dde3c692aa1bffa12 /src/bin/psql/describe.c | |
parent | 1da569ca1f1fd08ae728ccde0952b688feff7d9c (diff) |
Show "internal name" not "source code" in psql's \df+ command.
Our previous habit of showing the full function body is really
pretty unfriendly for tabular viewing of functions, and now that
we have \sf and \ef commands there seems no good reason why \df+
has to do it. It still seems to make sense to show prosrc for
internal and C-language functions, since in those cases prosrc
is just the C function name; but then let's rename the column to
"Internal name" which is a more accurate descriptor.
Isaac Morland
Discussion: https://postgr.es/m/CAMsGm5eqKc6J1=Lwn=ZONG=6ZDYWRQ4cgZQLqMuZGB1aVt_JBg@mail.gmail.com
Diffstat (limited to 'src/bin/psql/describe.c')
-rw-r--r-- | src/bin/psql/describe.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c index c8a0bb7b3a5..2084f5ccdac 100644 --- a/src/bin/psql/describe.c +++ b/src/bin/psql/describe.c @@ -410,14 +410,9 @@ describeFunctions(const char *functypes, const char *func_pattern, appendPQExpBuffer(&buf, ",\n l.lanname as \"%s\"", gettext_noop("Language")); - if (pset.sversion >= 140000) - appendPQExpBuffer(&buf, - ",\n COALESCE(pg_catalog.pg_get_function_sqlbody(p.oid), p.prosrc) as \"%s\"", - gettext_noop("Source code")); - else - appendPQExpBuffer(&buf, - ",\n p.prosrc as \"%s\"", - gettext_noop("Source code")); + appendPQExpBuffer(&buf, + ",\n CASE WHEN l.lanname IN ('internal', 'c') THEN p.prosrc END as \"%s\"", + gettext_noop("Internal name")); appendPQExpBuffer(&buf, ",\n pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"", gettext_noop("Description")); |