0001-Remove-source-code-display-from-df.patch
application/octet-stream
Filename: 0001-Remove-source-code-display-from-df.patch
Type: application/octet-stream
Part: 0
Patch
Format: format-patch
Series: patch 0001
Subject: Remove source code display from \df+
| File | + | − |
|---|---|---|
| src/bin/psql/describe.c | 3 | 8 |
| src/test/regress/expected/psql.out | 18 | 0 |
| src/test/regress/sql/psql.sql | 6 | 0 |
From 68c21506f56ca63fe4e94833a0920d81e224dfc4 Mon Sep 17 00:00:00 2001
From: Isaac Morland <isaac.morland@gmail.com>
Date: Tue, 17 Jan 2023 14:17:42 -0500
Subject: [PATCH] Remove source code display from \df+
The column is renamed to "Internal name" and will still show the internal
name for C and Internal functions.
---
src/bin/psql/describe.c | 11 +++--------
src/test/regress/expected/psql.out | 18 ++++++++++++++++++
src/test/regress/sql/psql.sql | 6 ++++++
3 files changed, 27 insertions(+), 8 deletions(-)
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index c8a0bb7b3a..7199bc0532 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 ELSE NULL END AS \"%s\"",
+ gettext_noop("Internal name"));
appendPQExpBuffer(&buf,
",\n pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"",
gettext_noop("Description"));
diff --git a/src/test/regress/expected/psql.out b/src/test/regress/expected/psql.out
index 8fc62cebd2..3c11afd915 100644
--- a/src/test/regress/expected/psql.out
+++ b/src/test/regress/expected/psql.out
@@ -5247,6 +5247,24 @@ reset work_mem;
pg_catalog | && | anyarray | anyarray | boolean | overlaps
(1 row)
+-- check \df+
+-- C
+\df+ utf8_to_iso8859
+ List of functions
+ Schema | Name | Result data type | Argument data types | Type | Volatility | Parallel | Owner | Security | Access privileges | Language | Internal name | Description
+------------+-----------------+------------------+-------------------------------------------------------+------+------------+----------+---------+----------+-------------------+----------+-----------------+--------------------------------------------------------
+ pg_catalog | utf8_to_iso8859 | integer | integer, integer, cstring, internal, integer, boolean | func | immutable | safe | vagrant | invoker | | c | utf8_to_iso8859 | internal conversion function for UTF8 to ISO-8859 2-16
+(1 row)
+
+-- Internal and other
+\df+ pg_relation_size
+ List of functions
+ Schema | Name | Result data type | Argument data types | Type | Volatility | Parallel | Owner | Security | Access privileges | Language | Internal name | Description
+------------+------------------+------------------+---------------------+------+------------+----------+---------+----------+-------------------+----------+------------------+--------------------------------------------------------------------
+ pg_catalog | pg_relation_size | bigint | regclass | func | volatile | safe | vagrant | invoker | | sql | | disk space usage for the main fork of the specified table or index
+ pg_catalog | pg_relation_size | bigint | regclass, text | func | volatile | safe | vagrant | invoker | | internal | pg_relation_size | disk space usage for the specified fork of a table or index
+(2 rows)
+
-- check \sf
\sf information_schema._pg_expandarray
CREATE OR REPLACE FUNCTION information_schema._pg_expandarray(anyarray, OUT x anyelement, OUT n integer)
diff --git a/src/test/regress/sql/psql.sql b/src/test/regress/sql/psql.sql
index 2da9665a19..d73b2f697f 100644
--- a/src/test/regress/sql/psql.sql
+++ b/src/test/regress/sql/psql.sql
@@ -1275,6 +1275,12 @@ reset work_mem;
\do - pg_catalog.int4
\do && anyarray *
+-- check \df+
+-- C
+\df+ utf8_to_iso8859
+-- Internal and other
+\df+ pg_relation_size
+
-- check \sf
\sf information_schema._pg_expandarray
\sf+ information_schema._pg_expandarray
--
2.32.1 (Apple Git-133)