Re: \describe*

From: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
To: Ibrar Ahmed <ibrar(dot)ahmad(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: \describe*
Date: 2019-03-04 18:45:23
Message-ID: CADkLM=dqmYRLyQoAp7Xmc0aV=JmhCzuun3m7zOitZ+roU2Bo5g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>
>
>> - Tab completion for \descibe-verbose.
>> I know that \d+ tab completion is also not there, but I think we must
>> have tab completion for \descibe-verbose.
>>
>> postgres=# \describe-
>> \describe-extension
>> \describe-replication-publication \describe-user-mapping
>> \describe-foreign-data-wrapper
>> \describe-replication-subscription \describe-view
>> \describe-foreign-server \describe-role
>> \describe-window-function
>> \describe-foreign-table \describe-rule
>> ...
>>
>
I just confirmed that there isn't tab completion for the existing S/+
options, so it's hard to justify them for the equivalent verbose suffixes.

> (1 row)
>> Invalid command \describe. Try \? for help.
>>
>>
>> I think this status is causing the problem.
>>
>>
>>
>> + /*
>> standard listing of interesting things */
>> + success =
>> listTables("tvmsE", NULL, show_verbose, show_system);
>> + }
>> + status = PSQL_CMD_UNKNOWN;
>>
>>
I'll look into this, thanks!

> - Confusion about \desc and \desC
>> There is confusion while running the \desc command. I know the problem,
>> but the user may confuse by this.
>> postgres=# \desC
>> List of foreign servers
>> Name | Owner | Foreign-data wrapper
>> ------+-------+----------------------
>> (0 rows)
>>
>> postgres=# \desc
>> Invalid command \desc. Try \? for help.
>>
>> - Auto-completion of commands.
>> There is some more confusion in the completion of commands.
>>
>> This command shows List of aggregates.
>> postgres=# \describe-aggregate-function
>> List of aggregate functions
>> Schema | Name | Result data type | Argument data types | Description
>> --------+------+------------------+---------------------+-------------
>> (0 rows)
>>
>>
>>
>> This command shows a list of relation "\d"
>> postgres=# \describe-aggregatE-function
>> List of relations
>> Schema | Name | Type | Owner
>> --------+------+-------+---------
>> public | foo | table | vagrant
>> (1 row)
>>
>> This command also shows a list of relations "\d".
>> postgres=# \describe-aggr
>> List of relations
>> Schema | Name | Type | Owner
>> --------+------+-------+---------
>> public | foo | table | vagrant
>> (1 row)
>>
>> This command shows error messages.
>> postgres=# \descr
>> Invalid command \descr. Try \? for help.
>>
>>
I will look into it.

>
>> I have done a brief code review except for the documentation code. I
>> don't like this code
>>
>> if (cmd_match(cmd,"describe-aggregate-function"))
>>
>> success = describeAggregates(pattern, show_verbose, show_system);
>> else if (cmd_match(cmd,
>> "describe-access-method"))
>> success = describeAccessMethods(pattern,
>> show_verbose);
>> else if (cmd_match(cmd,
>> "describe-tablespace"))
>> success = describeTablespaces(pattern,
>> show_verbose);
>> else if (cmd_match(cmd,
>> "describe-conversion"))
>> success = listConversions(pattern,
>> show_verbose, show_system);
>> else if (cmd_match(cmd, "describe-cast"))
>> success = listCasts(pattern, show_verbose
>>
>>
>> This can be achieved with the list/array/hash table, so I have changed
>> that code in the attached patch just for a sample if you want I can do that
>> for whole code.
>>
>
There's some problems with a hash table. The function signatures vary quite
a lot, and some require additional psql_scan_slash_options to be called.
The hash option, if implemented, probably should be expanded to all slash
commands, at which point maybe it belongs in psqlscanslash.l...

>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2019-03-04 18:46:50 Re: [Proposal] Table-level Transparent Data Encryption (TDE) and Key Management Service (KMS)
Previous Message Andres Freund 2019-03-04 18:32:11 Re: Segfault when restoring -Fd dump on current HEAD