diff options
| author | Tom Lane | 2021-04-08 03:02:16 +0000 |
|---|---|---|
| committer | Tom Lane | 2021-04-08 03:02:21 +0000 |
| commit | a3027e1e7f3d3a107ecd72d3b4d6333ea2aab6a5 (patch) | |
| tree | 4fcc9b9bb3af4030fc0fd3fe3004926cbc86b54a /src/test | |
| parent | f57a2f5e03054ade221e554c70e628e1ffae1b66 (diff) | |
Allow psql's \df and \do commands to specify argument types.
When dealing with overloaded function or operator names, having
to look through a long list of matches is tedious. Let's extend
these commands to allow specification of (input) argument types
to let such results be trimmed down. Each additional argument
is treated the same as the pattern argument of \dT and matched
against the appropriate argument's type name.
While at it, fix \dT (and these new options) to recognize the
usual notation of "foo[]" for "the array type over foo", and
to handle the special abbreviations allowed by the backend
grammar, such as "int" for "integer".
Greg Sabino Mullane, revised rather significantly by me
Discussion: https://postgr.es/m/CAKAnmmLF9Hhu02N+s7uAyLc5J1xZReg72HQUoiKhNiJV3_jACQ@mail.gmail.com
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/regress/expected/psql.out | 101 | ||||
| -rw-r--r-- | src/test/regress/sql/psql.sql | 13 |
2 files changed, 114 insertions, 0 deletions
diff --git a/src/test/regress/expected/psql.out b/src/test/regress/expected/psql.out index 9a51940530a..672937b2f88 100644 --- a/src/test/regress/expected/psql.out +++ b/src/test/regress/expected/psql.out @@ -5078,6 +5078,107 @@ List of access methods hash | uuid_ops | uuid | uuid | 2 | uuid_hash_extended (5 rows) +-- check \df, \do with argument specifications +\df *sqrt + List of functions + Schema | Name | Result data type | Argument data types | Type +------------+--------------+------------------+---------------------+------ + pg_catalog | dsqrt | double precision | double precision | func + pg_catalog | numeric_sqrt | numeric | numeric | func + pg_catalog | sqrt | double precision | double precision | func + pg_catalog | sqrt | numeric | numeric | func +(4 rows) + +\df *sqrt num* + List of functions + Schema | Name | Result data type | Argument data types | Type +------------+--------------+------------------+---------------------+------ + pg_catalog | numeric_sqrt | numeric | numeric | func + pg_catalog | sqrt | numeric | numeric | func +(2 rows) + +\df int*pl + List of functions + Schema | Name | Result data type | Argument data types | Type +------------+-------------+------------------+---------------------+------ + pg_catalog | int24pl | integer | smallint, integer | func + pg_catalog | int28pl | bigint | smallint, bigint | func + pg_catalog | int2pl | smallint | smallint, smallint | func + pg_catalog | int42pl | integer | integer, smallint | func + pg_catalog | int48pl | bigint | integer, bigint | func + pg_catalog | int4pl | integer | integer, integer | func + pg_catalog | int82pl | bigint | bigint, smallint | func + pg_catalog | int84pl | bigint | bigint, integer | func + pg_catalog | int8pl | bigint | bigint, bigint | func + pg_catalog | interval_pl | interval | interval, interval | func +(10 rows) + +\df int*pl int4 + List of functions + Schema | Name | Result data type | Argument data types | Type +------------+---------+------------------+---------------------+------ + pg_catalog | int42pl | integer | integer, smallint | func + pg_catalog | int48pl | bigint | integer, bigint | func + pg_catalog | int4pl | integer | integer, integer | func +(3 rows) + +\df int*pl * pg_catalog.int8 + List of functions + Schema | Name | Result data type | Argument data types | Type +------------+---------+------------------+---------------------+------ + pg_catalog | int28pl | bigint | smallint, bigint | func + pg_catalog | int48pl | bigint | integer, bigint | func + pg_catalog | int8pl | bigint | bigint, bigint | func +(3 rows) + +\df acl* aclitem[] + List of functions + Schema | Name | Result data type | Argument data types | Type +------------+-------------+------------------+----------------------------------------------------------------------------------------------------+------ + pg_catalog | aclcontains | boolean | aclitem[], aclitem | func + pg_catalog | aclexplode | SETOF record | acl aclitem[], OUT grantor oid, OUT grantee oid, OUT privilege_type text, OUT is_grantable boolean | func + pg_catalog | aclinsert | aclitem[] | aclitem[], aclitem | func + pg_catalog | aclremove | aclitem[] | aclitem[], aclitem | func +(4 rows) + +\df has_database_privilege oid text + List of functions + Schema | Name | Result data type | Argument data types | Type +------------+------------------------+------------------+---------------------+------ + pg_catalog | has_database_privilege | boolean | oid, text | func + pg_catalog | has_database_privilege | boolean | oid, text, text | func +(2 rows) + +\df has_database_privilege oid text - + List of functions + Schema | Name | Result data type | Argument data types | Type +------------+------------------------+------------------+---------------------+------ + pg_catalog | has_database_privilege | boolean | oid, text | func +(1 row) + +\dfa bit* small* + List of functions + Schema | Name | Result data type | Argument data types | Type +------------+---------+------------------+---------------------+------ + pg_catalog | bit_and | smallint | smallint | agg + pg_catalog | bit_or | smallint | smallint | agg + pg_catalog | bit_xor | smallint | smallint | agg +(3 rows) + +\do - pg_catalog.int4 + List of operators + Schema | Name | Left arg type | Right arg type | Result type | Description +------------+------+---------------+----------------+-------------+------------- + pg_catalog | - | | integer | integer | negate +(1 row) + +\do && anyarray * + List of operators + Schema | Name | Left arg type | Right arg type | Result type | Description +------------+------+---------------+----------------+-------------+------------- + pg_catalog | && | anyarray | anyarray | boolean | overlaps +(1 row) + -- -- combined queries -- diff --git a/src/test/regress/sql/psql.sql b/src/test/regress/sql/psql.sql index bf06bb87b50..f90a0270fc3 100644 --- a/src/test/regress/sql/psql.sql +++ b/src/test/regress/sql/psql.sql @@ -1229,6 +1229,19 @@ drop role regress_partitioning_role; \dAp+ btree float_ops \dAp * pg_catalog.uuid_ops +-- check \df, \do with argument specifications +\df *sqrt +\df *sqrt num* +\df int*pl +\df int*pl int4 +\df int*pl * pg_catalog.int8 +\df acl* aclitem[] +\df has_database_privilege oid text +\df has_database_privilege oid text - +\dfa bit* small* +\do - pg_catalog.int4 +\do && anyarray * + -- -- combined queries -- |
