Re: [PATCHES] Proposed patch - psql wraps at window width

2008-04-21 Thread Bruce Momjian
Bryce Nesbitt wrote: The newline handling code was, by far, the most complex part of this patch. While I think it would be nicer to filter up past the newline, I just don't see this as a common need. Large text fields with newlines are difficult to really view in psql anyway, and they are

Re: [PATCHES] Proposed patch - psql wraps at window width

2008-04-21 Thread Bruce Momjian
Bryce Nesbitt wrote: 1) \pset columns XX should make it clear that's for file output only. OK, docs updated. 2) There's an extra space, which breaks \pset border 2 717c717 fputc(' ', fout);; --- fputc(' ',

Re: [PATCHES] Proposed patch - psql wraps at window width

2008-04-21 Thread Alvaro Herrera
Bruce Momjian wrote: ! /* print a divider, middle columns only */ ! if ((j + 1) % col_count) { ! if (opt_border == 0) !

Re: [PATCHES] Proposed patch - psql wraps at window width

2008-04-21 Thread Bruce Momjian
Alvaro Herrera wrote: Bruce Momjian wrote: ! /* print a divider, middle columns only */ ! if ((j + 1) % col_count) { ! if (opt_border ==

Re: [PATCHES] Proposed patch - psql wraps at window width

2008-04-21 Thread Alvaro Herrera
Alvaro Herrera wrote: Bruce Momjian wrote: ! fputs(string_done ? : ; , fout); ! } } I think it's a bad idea to use the same : separator in the two

Re: [PATCHES] Proposed patch - psql wraps at window width

2008-04-21 Thread Bruce Momjian
Bruce Momjian wrote: I think it's a bad idea to use the same : separator in the two last cases. They are different and they should be displayed differently. I confirmed with Alvaro that he didn't notice the first uses a colon and the second a semicolon, so he is OK. FYI, I added a

Re: [PATCHES] Proposed patch - psql wraps at window width

2008-04-20 Thread Bryce Nesbitt
The newline handling code was, by far, the most complex part of this patch. While I think it would be nicer to filter up past the newline, I just don't see this as a common need. Large text fields with newlines are difficult to really view in psql anyway, and they are likely to be the

Re: [PATCHES] Proposed patch - psql wraps at window width

2008-04-20 Thread Bryce Nesbitt
1) \pset columns XX should make it clear that's for file output only. 2) There's an extra space, which breaks \pset border 2 717c717 fputc(' ', fout);; --- fputc(' ', fout); 842c842

Re: [PATCHES] Proposed patch - psql wraps at window width

2008-04-19 Thread Bruce Momjian
Bryce Nesbitt wrote: Bruce Momjian wrote: I don't think you need to do that to get it applied --- there is nothing windows-specific in your code. Is this ready to be applied? Do you want to send a final update or are you still testing? Looks good, but I suggest adding give up if

Re: [PATCHES] Proposed patch - psql wraps at window width

2008-04-18 Thread Bryce Nesbitt
Alvaro Herrera wrote: * Don't lose warning comments like this one (unless you've removed the assumption of course) /* * Assumption: This code used only on strings * without multibyte characters, otherwise * this_line-width strlen(this_ptr) and we get * an overflow */ In fact, that

Re: [PATCHES] Proposed patch - psql wraps at window width

2008-04-18 Thread Bryce Nesbitt
Peter Eisentraut wrote: Bruce Momjian wrote: I checked the use of COLUMNS and it seems bash updates the environment variable when a window is resized. I added ioctl(TIOCGWINSZ) if COLUMNS isn't set. We already had a call in print.c for detecting the number of rows on the screen to

Re: [PATCHES] Proposed patch - psql wraps at window width

2008-04-18 Thread Gregory Stark
Tom Lane [EMAIL PROTECTED] writes: Bryce Nesbitt [EMAIL PROTECTED] writes: pre wrap=I checked the use of COLUMNS and it seems bash updates the environment variable when a window is resized. [ Please get rid of the HTML formatting ... ] Bash can update the environment all it wants,

Re: [PATCHES] Proposed patch - psql wraps at window width

2008-04-18 Thread Bryce Nesbitt
Peter Eisentraut wrote: Bruce Momjian wrote: I checked the use of COLUMNS and it seems bash updates the environment variable when a window is resized. I added ioctl(TIOCGWINSZ) if COLUMNS isn't set. We already had a call in print.c for detecting the number of rows on the screen to

Re: [PATCHES] Proposed patch - psql wraps at window width

2008-04-18 Thread Gregory Stark
Bryce Nesbitt [EMAIL PROTECTED] writes: I asked the folks over at Experts Exchange to test the behavior of the ioctl I always thought that was a joke domain name, like Pen Island.com. -- Gregory Stark EnterpriseDB http://www.enterprisedb.com Ask me about EnterpriseDB's PostGIS

Re: [PATCHES] Proposed patch - psql wraps at window width

2008-04-18 Thread Joshua D. Drake
On Fri, 18 Apr 2008 17:21:26 +0100 Gregory Stark [EMAIL PROTECTED] wrote: Bryce Nesbitt [EMAIL PROTECTED] writes: I asked the folks over at Experts Exchange to test the behavior of the ioctl I always thought that was a joke domain name, like Pen Island.com. Its not and a lot of

Re: [PATCHES] Proposed patch - psql wraps at window width

2008-04-17 Thread Alvaro Herrera
Bruce Momjian wrote: In testing I found the regression tests were failing because of a divide by zero error (fixed), and a missing case where the column delimiter has to be :. In fact I now see all your line continuation cases using : rather than !. It actually looks better --- ! was too

Re: [PATCHES] Proposed patch - psql wraps at window width

2008-04-17 Thread Peter Eisentraut
Bruce Momjian wrote: I checked the use of COLUMNS and it seems bash updates the environment variable when a window is resized.  I added ioctl(TIOCGWINSZ) if COLUMNS isn't set.  We already had a call in print.c for detecting the number of rows on the screen to determine if the pager should be

Re: [PATCHES] Proposed patch - psql wraps at window width

2008-04-17 Thread Bruce Momjian
Bryce Nesbitt wrote: Bruce Momjian wrote: I spent time reviewing your patch --- quite impressive. I have attached and updated version with mostly stylistic changes. In testing I found the regression tests were failing because of a divide by zero error (fixed), and a missing case

Re: [PATCHES] Proposed patch - psql wraps at window width

2008-04-17 Thread Alvaro Herrera
Bryce Nesbitt wrote: I've attached a patch, against current 8.4 cvs, which optionally sets a maximum width for psql output: Some random comments: * Don't use C++ style comments (//). Some compilers don't like these. * Beware of brace position: we use braces on their own, indented at the

Re: [PATCHES] Proposed patch - psql wraps at window width

2008-04-17 Thread Bruce Momjian
Alvaro is correct. I made most or all of these adjustments in the updated version I posted yesterday. --- Alvaro Herrera wrote: Bryce Nesbitt wrote: I've attached a patch, against current 8.4 cvs, which optionally sets

Re: [PATCHES] Proposed patch - psql wraps at window width

2008-04-17 Thread Alvaro Herrera
Bruce Momjian wrote: Alvaro is correct. I made most or all of these adjustments in the updated version I posted yesterday. Doh. I didn't realize you had posted a new version :-( People is complaining here that we don't teach people here anyway, so hopefully my comments were still useful

Re: [PATCHES] Proposed patch - psql wraps at window width

2008-04-17 Thread Bruce Momjian
Alvaro Herrera wrote: Bruce Momjian wrote: Alvaro is correct. I made most or all of these adjustments in the updated version I posted yesterday. Doh. I didn't realize you had posted a new version :-( People is complaining here that we don't teach people here anyway, so hopefully

Re: [PATCHES] Proposed patch - psql wraps at window width

2008-04-17 Thread Gregory Stark
Peter Eisentraut [EMAIL PROTECTED] writes: Bruce Momjian wrote: I checked the use of COLUMNS and it seems bash updates the environment variable when a window is resized.  I added ioctl(TIOCGWINSZ) if COLUMNS isn't set.  We already had a call in print.c for detecting the number of rows on the

Re: [PATCHES] Proposed patch - psql wraps at window width

2008-04-17 Thread Tom Lane
Gregory Stark [EMAIL PROTECTED] writes: Also, how would you suggest figuring the width to use for output going to a file? ioctl is irrelevant in that case, imho it should just default to 80 columns if COLUMNS is unset. It would be a spectacularly awful idea for this patch to affect the output

Re: [PATCHES] Proposed patch - psql wraps at window width

2008-04-17 Thread Gregory Stark
Tom Lane [EMAIL PROTECTED] writes: Gregory Stark [EMAIL PROTECTED] writes: Also, how would you suggest figuring the width to use for output going to a file? ioctl is irrelevant in that case, imho it should just default to 80 columns if COLUMNS is unset. It would be a spectacularly awful

Re: [PATCHES] Proposed patch - psql wraps at window width

2008-04-17 Thread Bryce Nesbitt
It would be a spectacularly awful idea for this patch to affect the output to a file at all. . It sucks to run a program, decide you want to capture that output and find you get something else. It *really* sucks to find there's just no way to get the same output short of

Re: [PATCHES] Proposed patch - psql wraps at window width

2008-04-17 Thread Bryce Nesbitt
Peter Eisentraut wrote: Bruce Momjian wrote: I checked the use of COLUMNS and it seems bash updates the environment variable when a window is resized.  I added ioctl(TIOCGWINSZ) if COLUMNS isn't set.  We already had a call in print.c for detecting the number of rows on the

Re: [PATCHES] Proposed patch - psql wraps at window width

2008-04-17 Thread Bryce Nesbitt
Bruce Momjian wrote: I also found that for hugely wide output it was better to give up (do nothing), rather than mangle the output in a futile attempt to squash it to the window width. So there is one more clause in the wrapping if. Was it because of performance? I have

Re: [PATCHES] Proposed patch - psql wraps at window width

2008-04-17 Thread Tom Lane
Bryce Nesbitt [EMAIL PROTECTED] writes: pre wrap=I checked the use of COLUMNS and it seems bash updates the environment variable when a window is resized. [ Please get rid of the HTML formatting ... ] Bash can update the environment all it wants, but that will not affect what is seen by

Re: [PATCHES] Proposed patch - psql wraps at window width

2008-04-16 Thread Bruce Momjian
Bryce Nesbitt wrote: I've attached a patch, against current 8.4 cvs, which optionally sets a maximum width for psql output: # \pset format aligned-wrapped # \pset border 2 # select * from distributors order by did; +--++-+---+ |

Re: [PATCHES] Proposed patch - psql wraps at window width

2008-04-16 Thread Bryce Nesbitt
Bruce Momjian wrote: I spent time reviewing your patch --- quite impressive. I have attached and updated version with mostly stylistic changes. In testing I found the regression tests were failing because of a divide by zero error (fixed), and a missing case where the column delimiter has to

[PATCHES] Proposed patch - psql wraps at window width

2008-03-05 Thread Bryce Nesbitt
I've attached a patch, against current 8.4 cvs, which optionally sets a maximum width for psql output: # \pset format aligned-wrapped # \pset border 2 # select * from distributors order by did; +--++-+---+ | did |name|