Re: [HACKERS] psql's \d and \dt are sending their complaints to different output files - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [HACKERS] psql's \d and \dt are sending their complaints to different output files
Date
Msg-id 12010.1497908440@sss.pgh.pa.us
Whole thread Raw
In response to Re: [HACKERS] psql's \d and \dt are sending their complaints todifferent output files  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
List pgsql-hackers
Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:
> On 6/19/17 09:00, Oleksandr Shulgin wrote:
>> postgres=# \d xxx
>> Did not find any relation named "xxx".
>> postgres=# \dt xxx
>> No matching relations found.

> I think this is intentional.

> The first command is "show me relation xxx", and that gives an error
> message if it does not exist (and would also create an appropriate exit
> status if certain options are used).
> The second command says "show me all relations matched 'xxx'".  The
> result of this is successful execution showing nothing.  The message it
> prints is a "courtesy" message.

I don't buy that line of argument one bit, because both commands take
pattern arguments.

regression=# \d fool*
Did not find any relation named "fool*".
regression=# \dt fool*
No matching relations found.
regression=# create table fool1(f1 int);
CREATE TABLE
regression=# create table fool2(f1 int);
CREATE TABLE
regression=# \d fool*              Table "public.fool1"Column |  Type   | Collation | Nullable | Default 
--------+---------+-----------+----------+---------f1     | integer |           |          | 
              Table "public.fool2"Column |  Type   | Collation | Nullable | Default 
--------+---------+-----------+----------+---------f1     | integer |           |          | 

regression=# \dt fool*        List of relationsSchema | Name  | Type  |  Owner   
--------+-------+-------+----------public | fool1 | table | postgrespublic | fool2 | table | postgres
(2 rows)

AFAICS, this is just randomly different responses for identical
situations.

There's certainly room to quibble about whether this is an error
condition or not, but I'm not very sure which side of that argument
I'd come down on.  In any case the main point is that different
\d commands are doing different things for no very obvious reason.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: [HACKERS] CREATE SUBSCRIPTION documentation
Next
From: "David G. Johnston"
Date:
Subject: Re: [HACKERS] psql's \d and \dt are sending their complaints todifferent output files