Re: Proposed patch - psql wraps at window width

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Gregory Stark <stark(at)enterprisedb(dot)com>
Cc: Bryce Nesbitt <bryce2(at)obviously(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Brendan Jurd <direvus(at)gmail(dot)com>, heikki(at)enterprisedb(dot)com
Subject: Re: Proposed patch - psql wraps at window width
Date: 2008-04-29 12:18:52
Message-ID: 200804291218.m3TCIqw08844@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Gregory Stark wrote:
> "Bruce Momjian" <bruce(at)momjian(dot)us> writes:
>
> > Gregory Stark wrote:
> >> > Now, we could get fancy and honor $COLUMNS only in non-interactive mode,
> >> > but that seems confusing.
> >>
> >> We could always read COLUMNS early on before readline is initialized and stash
> >> the value away in a variable. But...
> >>
> >> We would only look at COLUMNS if the ioctl for window size failed. Does
> >> psql/readline do anything to COLUMNS in that case?
> >
> > We do look at COLUMNS if the ioctl() fails, but not for file/pipe
> > output.
>
> Yeah, it looks like your most recent patch still has the bug that if the user
> specifies wrapped there are some complicated rules creating cases where it
> will ignore the user's request and use un-wrapped output instead.

Can you be more specific? You mean if the headings don't fit? Yea,
that is true. I am thinking of adding a \pset auto format to \x in
those cases, but that if for later.

Also, I thiink you could do in your .psqlrc:

\pset columns `echo $COLUMNS`

to get the behavior you want.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2008-04-29 12:53:34 Re: [HACKERS] [DOCS] pg_total_relation_size() and CHECKPOINT
Previous Message Zubkovsky, Sergey 2008-04-29 12:18:25 Re: [HACKERS] [DOCS] pg_total_relation_size() and CHECKPOINT