Re: [GENERAL] Any thoughts on making a psql meta-command "hide (orshow alt text) if no results"? - Mailing list pgsql-general

From Melvin Davidson
Subject Re: [GENERAL] Any thoughts on making a psql meta-command "hide (orshow alt text) if no results"?
Date
Msg-id CANu8FixRzdG6+Kj640TYH47K_um2P9WYgC31FFtGLGu+8Zwr-w@mail.gmail.com
Whole thread Raw
In response to [GENERAL] Any thoughts on making a psql meta-command "hide (or show alt text)if no results"?  ("David G. Johnston" <david.g.johnston@gmail.com>)
Responses Re: [GENERAL] Any thoughts on making a psql meta-command "hide (orshow alt text) if no results"?  ("David G. Johnston" <david.g.johnston@gmail.com>)
List pgsql-general


On Tue, Aug 8, 2017 at 9:16 PM, David G. Johnston <david.g.johnston@gmail.com> wrote:
Hey all, looking for thoughts on a feature request:

I run quite a few queries, using psql, that are intended for exceptional situations.  When there are no results, which is expected, I still get the table header and basic frame showing up in the output.  The option I'd like is to be able to suppress the output of the empty table (and header if there is one) or possibly substitute the empty table with user-supplied text.

Thinking something that is used like \g

SELECT * FROM (VALUES (1)) vals (v) WHERE v = 0 \ghideifempty

[SQL] \galtifempty 'No values matching 0 in vals'

The names are descriptive, not suggestions...

David J.

>The option I'd like is to be able to suppress the output of the empty table (and header if there is one)
Have you looked at the TUPLES ONLY option?

-t
--tuples-only

Turn off printing of column names and result row count footers, etc. This is equivalent to the \t command.

https://www.postgresql.org/docs/9.4/static/app-psql.html

--
Melvin Davidson
I reserve the right to fantasize.  Whether or not you
wish to share my fantasy is entirely up to you.

pgsql-general by date:

Previous
From: "David G. Johnston"
Date:
Subject: [GENERAL] Any thoughts on making a psql meta-command "hide (or show alt text)if no results"?
Next
From: "David G. Johnston"
Date:
Subject: Re: [GENERAL] Any thoughts on making a psql meta-command "hide (orshow alt text) if no results"?