From 5c7f56a42d9d428b388be07c70407d8ef6dda82e Mon Sep 17 00:00:00 2001 From: Alexander Korotkov Date: Sat, 11 Jul 2020 14:14:49 +0300 Subject: [PATCH] Improvements to psql \dAo and \dAp commands * Strategy number and purpose are essential information for opfamily operator. So, show those columns in non-verbose output. * "Left/right arg type" \dAp column names are confusing, because those type don't necessary match to function arguments. Rename them to "Registered left/right type". Reported-by: Peter Eisentraut, Tom Lane Discussion: https://postgr.es/m/2edc7b27-031f-b2b6-0db2-864241c91cb9%402ndquadrant.com --- src/bin/psql/describe.c | 28 ++++++++++----------- src/test/regress/expected/psql.out | 50 +++++++++++++++++++------------------- 2 files changed, 39 insertions(+), 39 deletions(-) diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c index cd39b913cda..135b2ffe5f5 100644 --- a/src/bin/psql/describe.c +++ b/src/bin/psql/describe.c @@ -6248,23 +6248,23 @@ listOpFamilyOperators(const char *access_method_pattern, " END,\n" " pg_catalog.format_type(o.amoplefttype, NULL),\n" " pg_catalog.format_type(o.amoprighttype, NULL)\n" - " ) AS \"%s\"\n", + " ) AS \"%s\"\n," + " o.amopstrategy AS \"%s\",\n" + " CASE o.amoppurpose\n" + " WHEN 'o' THEN '%s'\n" + " WHEN 's' THEN '%s'\n" + " END AS \"%s\"\n", gettext_noop("AM"), gettext_noop("Operator family"), - gettext_noop("Operator")); + gettext_noop("Operator"), + gettext_noop("Strategy"), + gettext_noop("ordering"), + gettext_noop("search"), + gettext_noop("Purpose")); if (verbose) appendPQExpBuffer(&buf, - ", o.amopstrategy AS \"%s\",\n" - " CASE o.amoppurpose\n" - " WHEN 'o' THEN '%s'\n" - " WHEN 's' THEN '%s'\n" - " END AS \"%s\",\n" - " ofs.opfname AS \"%s\"\n", - gettext_noop("Strategy"), - gettext_noop("ordering"), - gettext_noop("search"), - gettext_noop("Purpose"), + ", ofs.opfname AS \"%s\"\n", gettext_noop("Sort opfamily")); appendPQExpBuffer(&buf, "FROM pg_catalog.pg_amop o\n" @@ -6341,8 +6341,8 @@ listOpFamilyFunctions(const char *access_method_pattern, " p.proname AS \"%s\"\n", gettext_noop("AM"), gettext_noop("Operator family"), - gettext_noop("Left arg type"), - gettext_noop("Right arg type"), + gettext_noop("Registered left type"), + gettext_noop("Registered right type"), gettext_noop("Number"), gettext_noop("Function")); diff --git a/src/test/regress/expected/psql.out b/src/test/regress/expected/psql.out index 7d2d6328fc8..ae4d1e58072 100644 --- a/src/test/regress/expected/psql.out +++ b/src/test/regress/expected/psql.out @@ -4979,36 +4979,36 @@ List of access methods (20 rows) \dAo * pg_catalog.jsonb_path_ops - List of operators of operator families - AM | Operator family | Operator ------+-----------------+---------------------- - gin | jsonb_path_ops | @> (jsonb, jsonb) - gin | jsonb_path_ops | @? (jsonb, jsonpath) - gin | jsonb_path_ops | @@ (jsonb, jsonpath) + List of operators of operator families + AM | Operator family | Operator | Strategy | Purpose +-----+-----------------+----------------------+----------+--------- + gin | jsonb_path_ops | @> (jsonb, jsonb) | 7 | search + gin | jsonb_path_ops | @? (jsonb, jsonpath) | 15 | search + gin | jsonb_path_ops | @@ (jsonb, jsonpath) | 16 | search (3 rows) \dAp btree float_ops - List of support functions of operator families - AM | Operator family | Left arg type | Right arg type | Number | Function --------+-----------------+------------------+------------------+--------+--------------------- - btree | float_ops | double precision | double precision | 1 | btfloat8cmp - btree | float_ops | double precision | double precision | 2 | btfloat8sortsupport - btree | float_ops | double precision | double precision | 3 | in_range - btree | float_ops | real | real | 1 | btfloat4cmp - btree | float_ops | real | real | 2 | btfloat4sortsupport - btree | float_ops | double precision | real | 1 | btfloat84cmp - btree | float_ops | real | double precision | 1 | btfloat48cmp - btree | float_ops | real | double precision | 3 | in_range + List of support functions of operator families + AM | Operator family | Registered left type | Registered right type | Number | Function +-------+-----------------+----------------------+-----------------------+--------+--------------------- + btree | float_ops | double precision | double precision | 1 | btfloat8cmp + btree | float_ops | double precision | double precision | 2 | btfloat8sortsupport + btree | float_ops | double precision | double precision | 3 | in_range + btree | float_ops | real | real | 1 | btfloat4cmp + btree | float_ops | real | real | 2 | btfloat4sortsupport + btree | float_ops | double precision | real | 1 | btfloat84cmp + btree | float_ops | real | double precision | 1 | btfloat48cmp + btree | float_ops | real | double precision | 3 | in_range (8 rows) \dAp * pg_catalog.uuid_ops - List of support functions of operator families - AM | Operator family | Left arg type | Right arg type | Number | Function --------+-----------------+---------------+----------------+--------+-------------------- - btree | uuid_ops | uuid | uuid | 1 | uuid_cmp - btree | uuid_ops | uuid | uuid | 2 | uuid_sortsupport - btree | uuid_ops | uuid | uuid | 4 | btequalimage - hash | uuid_ops | uuid | uuid | 1 | uuid_hash - hash | uuid_ops | uuid | uuid | 2 | uuid_hash_extended + List of support functions of operator families + AM | Operator family | Registered left type | Registered right type | Number | Function +-------+-----------------+----------------------+-----------------------+--------+-------------------- + btree | uuid_ops | uuid | uuid | 1 | uuid_cmp + btree | uuid_ops | uuid | uuid | 2 | uuid_sortsupport + btree | uuid_ops | uuid | uuid | 4 | btequalimage + hash | uuid_ops | uuid | uuid | 1 | uuid_hash + hash | uuid_ops | uuid | uuid | 2 | uuid_hash_extended (5 rows) -- 2.14.3