Re: Proposed patch - psql wraps at window width

Поиск
Список
Период
Сортировка
От Aidan Van Dyk
Тема Re: Proposed patch - psql wraps at window width
Дата
Msg-id 20080506165358.GH18081@yugib.highrise.ca
обсуждение исходный текст
Ответ на Re: Proposed patch - psql wraps at window width  (Bruce Momjian <bruce@momjian.us>)
Список pgsql-hackers
* Bruce Momjian <bruce@momjian.us> [080506 11:59]:

> > But one of the interesting things is that psql has an is *interactive*
> > mode (something the GNU utils don't have to worry about).  So *when* you
> > choose to figure out your columns is important, and really impacts
> > behaviour too.
> > 
> > For instance, if I was doing a query, I often to it interactively first:
> >     SELECT [...] FROM [....] LIMIT 50;
> > And when I'm sure I have the right values,expressions, column aliases,
> > etc, I do:
> >     \o /tmp/output
> >     SELECT [...] FROM [...];
> >     \o
> > And in this case, I would expect that /tmp/output would have identical
> > formatting to the LIMITed query I just ran interactively, not matter
> > what setting I had for format/wrapped/auto/$COLUMNS.
> 
> The only thing we could do there perhaps is to have psql wrap file
> output to the terminal width if outputting to a pipe/file, but only from
> an interactive session, but that is just too odd.  If we make psql too
> automatic it will be hard to explain and have more surprises.

Yes, and *this* is the tough part.  And *I* think that the control of
wrapping/width should be based on psql's output fd/$COLUMNS, not
necessarily the query output buffer fd, because I want the interactive
output to be identical when I run the query and let psql automatically
pipe it through $PAGER and when I run the query and tell psql \o it to
pipe it somewhere specific.

Of course, all over-ridden by some specific \pset to make it all more
complicated ;-)
> I just looked at coreutils-6.9 and 5.97 and neither manual has a mention
> of COLUMNS.  Seems this is some Debian manual addition or something.  I
> don't see it on Ubuntu 7.10 either.

Yes, the man pages point to the Texinfo manual for full
documentation:http://www.gnu.org/software/coreutils/manual/html_node/General-output-formatting.html#General-output-formatting

a.

-- 
Aidan Van Dyk                                             Create like a god,
aidan@highrise.ca                                       command like a king,
http://www.highrise.ca/                                   work like a slave.

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Proposed patch - psql wraps at window width
Следующее
От: Andrew Dunstan
Дата:
Сообщение: alter + preserving dependencies