Any thoughts on making a psql meta-command "hide (or show alt text) if no results"?

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Any thoughts on making a psql meta-command "hide (or show alt text) if no results"?
Date: 2017-08-09 01:16:34
Message-ID: CAKFQuwaZ+PncWtOZYZdMqPjWKc12qGNWPswwuw6TztR31Yh38A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Melvin Davidson 2017-08-09 01:25:40 Re: Any thoughts on making a psql meta-command "hide (or show alt text) if no results"?
Previous Message Peter Eisentraut 2017-08-08 23:30:36 Re: Compiling libpq only on Linux