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

From Gregory Stark
Subject Re: Proposed patch - psql wraps at window width
Date
Msg-id 871w4u7ufe.fsf@oxford.xeocode.com
Whole thread Raw
In response to Re: Proposed patch - psql wraps at window width  (Bruce Momjian <bruce@momjian.us>)
Responses Re: Proposed patch - psql wraps at window width
List pgsql-hackers
"Bruce Momjian" <bruce@momjian.us> writes:

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

Some other idea for the name of it? Not particularly. I like your later
suggestion of "auto". Perhaps just "wrapped" and "auto"?

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

In general I don't like such things but it seems to be what you're trying to
do. And also what Tom seems to be yearning for when he says that it shouldn't
affect file output. And if we do it we should do it properly and not hobble
both modes.

Note that basing it on the window size ioctl doesn't actually dtrt either.
What you really want is for it to depend on isatty(). If isatty(fout) is true
then you want to try to take the interactive default even if the ioctl fails.

Trying to join the two decisions means that nobody will be happy. If you ssh
in you won't get wrapped format, if you redirect to a file and specify wrapped
format explicitly you'll be frustrated that you're still not getting it. And
if you do want those things so you \pset columns you'll find it starts doing
it even when you -f file.dmp -- which doesn't seem bad to me but it means it
isn't satisfying your desires.

> 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.


--  Gregory Stark EnterpriseDB          http://www.enterprisedb.com Ask me about EnterpriseDB's On-Demand Production
Tuning


pgsql-hackers by date:

Previous
From: Gregory Stark
Date:
Subject: Re: Proposed patch - psql wraps at window width
Next
From: Tom Lane
Date:
Subject: Re: Proposed patch - psql wraps at window width