On 6/19/17 09:00, Oleksandr Shulgin wrote:
> I wonder if it is intentional that \d complains on stderr if it cannot
> find relations to match, but \dt prints the message to the current
> output file?
>
> postgres=# \d xxx
> Did not find any relation named "xxx".
> postgres=# \dt xxx
> No matching relations found.
>
> I've noticed the difference exactly because my output was
> (accidentally) redirected to a file and I didn't see the complaint from
> the 2nd backslash command.
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.
Maybe there is something to tweak here, but the basic distinction of
what is an error and what isn't should be preserved.
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services