Re: Proposed patch - psql wraps at window width - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: Proposed patch - psql wraps at window width
Date
Msg-id 200804242036.m3OKacZ22795@momjian.us
Whole thread Raw
In response to Re: Proposed patch - psql wraps at window width  (Gregory Stark <stark@enterprisedb.com>)
Responses Re: Proposed patch - psql wraps at window width  (Gregory Stark <stark@enterprisedb.com>)
List pgsql-hackers
Gregory Stark wrote:
> "Bruce Momjian" <bruce@momjian.us> writes:
> 
> > I think the API in the patch is the best I am going to do to keep
> > everyone happy --- 'wrapped' doesn't affect file/pipe output unless you
> > also tell it the width you want.  Most interactive users are going to
> > set 'wrapped' and never set the width so it is automatically determined.
> 
> Aaah, I think that's the key to where we're going wrong.
> 
> Trying to use the columns logic to encode two separate decisions. "wrapped or
> not wrapped" and "how wide".

Well, they kind of fit because there is no good way to know the width
they would want for file/pipe output (no the terminal width isn't very
helpful in most cases).  Bottom line is we are going to need a way to
specify the width for wrapped file/pipe (COLUMNS is not something that
is easily set), and \pset columns seems to allow both the setting of the
width and saying we want wrapping for file/pipe.

I am not excited about 'wrapped-interactive' and 'wrapped-all' formats. 
Do you have some other idea in mind?

> I think this also clarifies Tom's objection. He's worried about people
> configuring psql for interactive use and being surprised when their automated
> scripts fail to parse the resulting output.
> 
> We do need a way to specifically request wrapped format, but if we want a way
> to say "wrapped format only on a terminal" then we should have a mode for that
> too.
> 
> But once we're in wrapped format we should stick to it and always follow the
> same logic to determine the width.

I can't think of any cases where we have one setting for interactive and
another for all uses.

I do think we might be adding an 'auto' format the does
aligned/wrapped/expanded based on the table width, but only for
interactive use.

--  Bruce Momjian  <bruce@momjian.us>        http://momjian.us EnterpriseDB
http://enterprisedb.com
 + If your life is a hard drive, Christ can be your backup. +


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Proposed patch - psql wraps at window width
Next
From: Alvaro Herrera
Date:
Subject: Re: Proposed patch - psql wraps at window width