Re: pgsql-server/ oc/src/sgml/ref/psql-ref.sgml rc ...

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-committers(at)postgresql(dot)org
Subject: Re: pgsql-server/ oc/src/sgml/ref/psql-ref.sgml rc ...
Date: 2002-11-08 22:03:26
Message-ID: 200211082203.gA8M3QX29475@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Tom Lane wrote:
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > So you are suggesting invoking the pager if the output goes over the
> > display length, no matter how many rows? Do you know how to determine
> > the output width before displaying any rows?
>
> The thing must compute the output width in order to align the column
> headers, no? It might be that the code is structured in a way that
> the info isn't readily available when we'd start the pager, but at
> least in principle it's doable ...

Yes, it does compute the width, but later than the opening of the output
FILE*. See psql/print.c:

switch (opt->format)
{
case PRINT_UNALIGNED:
if (opt->expanded)
print_unaligned_vertical(title, headers, cells, footers, opt->fi
eldSep, opt->recordSep, opt->tuples_only, output);
else
print_unaligned_text(title, headers, cells, footers, opt->fieldS
ep, opt->recordSep, opt->tuples_only, output);
break;

Theoretically, yes, it could be done. My feeling is we can remove
'\pset pager always' is someone wants to implement this. Also, consider
that the \x and other output formats don't pre-align data, so overly
long lines may be much harder to determine in those cases.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Marc G. Fournier 2002-11-08 23:10:02 Re: pgsql-server/src/backend access/transam/xlog.c ...
Previous Message Tom Lane 2002-11-08 21:21:00 Re: pgsql-server/ oc/src/sgml/ref/psql-ref.sgml rc ...