Re: Maintaining blank lines in psql output?

From: raf <raf(at)raf(dot)org>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Maintaining blank lines in psql output?
Date: 2023-01-17 23:21:26
Message-ID: Y8ctdjpr/2UtrwEF@raf.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Jan 17, 2023 at 04:10:50PM -0700, "David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> wrote:

> On Tue, Jan 17, 2023 at 4:07 PM raf <raf(at)raf(dot)org> wrote:
>
> > On Tue, Jan 17, 2023 at 02:22:22PM -0700, "David G. Johnston" <
> > david(dot)g(dot)johnston(at)gmail(dot)com> wrote:
> >
> > > On Tue, Jan 17, 2023 at 1:48 PM Ron <ronljohnsonjr(at)gmail(dot)com> wrote:
> > >
> > > >
> > > > White space can of course make things easy to read, but psql seems to
> > > > ignore
> > > > those blank lines. Is there any way to retain them in psql output?
> > > >
> > > >
> > > Nope, there is no setting for psql to print all blank lines it encounters
> > > to stdout. If you want to format your output with stuff other than query
> > > results it provides \echo
> > >
> > > David J.
> >
> > Perhaps the best you can do is something like adding:
> >
> > select '';
> >
> > or
> >
> > raise notice '';
> >
> > It won't result in just a blank line, but it will separate things.
> >
> >
> Those both seem much more complicated than \echo for the same (or worse)
> effect. You'd have to wrap the raise notice inside a do block which itself
> would then be executed by the server...
>
> David J.

Good point. I didn't read it right. select/raise make more sense
out of the context of psql (i.e. in sql/plpgsql). \echo makes more
sense in psql.

cheers,
raf

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ron 2023-01-18 00:22:21 Re: Maintaining blank lines in psql output?
Previous Message David G. Johnston 2023-01-17 23:10:50 Re: Maintaining blank lines in psql output?