Обсуждение: BUG #2565: pg tool doesn't detect window size changes

Поиск
Список
Период
Сортировка

BUG #2565: pg tool doesn't detect window size changes

От
"PFudd"
Дата:
The following bug has been logged online:

Bug reference:      2565
Logged by:          PFudd
Email address:      kernel@pkts.ca
PostgreSQL version: 8.1.4
Operating system:   Fedora Core 5
Description:        pg tool doesn't detect window size changes
Details:

This is a minor bug, but it would be nice to have fixed.

If you open a terminal window in linux (xterm, rxvt, whatever; I'm using
unicode rxvt), and start pg, you can use it with no problem.  However, if
you change the window size while you're in pg, the line wrapping of the
command line messes up.  Other programs work correctly (see 'vim').

On a related note, when the results of a select are being displayed on the
screen, showing a page at a time doesn't work right if any rows are longer
than the width of the screen; the first lines scroll off the top.  If pg
didn't know the width of the page, this would be acceptable, but as the
command line shows, it *does* know, at least when the program starts.

Thanks for a great system!

Re: BUG #2565: pg tool doesn't detect window size changes

От
Tom Lane
Дата:
"PFudd" <kernel@pkts.ca> writes:
> If you open a terminal window in linux (xterm, rxvt, whatever; I'm using
> unicode rxvt), and start pg, you can use it with no problem.  However, if
> you change the window size while you're in pg, the line wrapping of the
> command line messes up.  Other programs work correctly (see 'vim').

This gripe should be directed to the authors of the readline library.

> On a related note, when the results of a select are being displayed on the
> screen, showing a page at a time doesn't work right if any rows are longer
> than the width of the screen; the first lines scroll off the top.  If pg
> didn't know the width of the page, this would be acceptable, but as the
> command line shows, it *does* know, at least when the program starts.

... and this one to the authors of whatever pager you are using.

            regards, tom lane

Re: BUG #2565: pg tool doesn't detect window size changes

От
tomas@tuxteam.de
Дата:
On Mon, Aug 07, 2006 at 09:40:59PM +0000, PFudd wrote:
>=20
> The following bug has been logged online:
>=20
> Bug reference:      2565
> Logged by:          PFudd
> Email address:      kernel@pkts.ca
> PostgreSQL version: 8.1.4
> Operating system:   Fedora Core 5
> Description:        pg tool doesn't detect window size changes
> Details:=20

[...]

Sorry for my ignorance, but... what is this "pg tool"? (on my system
there is a pg command, but it is the pager and has'nt anything to do
with PostgreSQL).

Thsnks
-- tom=C3=A1s

Re: BUG #2565: pg tool doesn't detect window size changes

От
PF
Дата:
On Wed, 2006-08-09 at 05:31 +0000, tomas@tuxteam.de wrote:
> On Mon, Aug 07, 2006 at 09:40:59PM +0000, PFudd wrote:
> >
> > The following bug has been logged online:
> >
> > Bug reference:      2565
> > Logged by:          PFudd
> > Email address:      kernel@pkts.ca
> > PostgreSQL version: 8.1.4
> > Operating system:   Fedora Core 5
> > Description:        pg tool doesn't detect window size changes
> > Details:
>
> [...]
>
> Sorry for my ignorance, but... what is this "pg tool"? (on my system
> there is a pg command, but it is the pager and has'nt anything to do
> with PostgreSQL).

Sorry, I had created an expect script for psql called pg, and forgot I
had done it.  Just didn't want to deal with the command line arguments
and the password prompt.

After unsetting the PAGER environment variable (which was 'less') and
not using the expect script, everything works properly.  The window size
changes were not being forwarded by expect, and 'more' did a perfect job
with long lines, whereas 'less' did not.

Upon further investigation (as I couldn't believe less would suck at
this) it turns out that the 'r' option in my 'LESS' environment variable
was causing the line wrap breakage (r = show raw escape sequences).

Ok, I've found these solutions: stop using 'expect' and remove the 'r'
from the LESS environment variable.

Next question: can anyone tell me how to automate password logins with
psql?

Thanks!

The old expect script (doesn't pass window change signals):
------
#!/usr/bin/expect -f
set timeout 2
spawn psql -h localhost -U admin -W processdb
match_max 100000
expect -exact "Password for user admin: "
send -- "some password here\r"
expect {
  "protein=#" {;}
  "FATAL:" {puts "Failure1.";exit 2;}
  default {puts "Failure2.";exit 2;}
}
interact
--
PF <kernel@pkts.ca>