psql ctrl+f skips displaying of one record and displays skipping one line

Started by vignesh Cover 6 years ago6 messageshackers
Jump to latest
#1vignesh C
vignesh21@gmail.com

Hi,

One observation when we execute a select query having results more than the
screen space available and press ctrl+f to display the remaining records,
one of the record was not displayed and the message "...skipping one line"
was displayed.

I'm not sure if this is intentional behaviour.

Steps for the same:
postgres=# create table psqltest as select generate_series(1,50);
SELECT 50
postgres=# select * from psqltest;
generate_series
-----------------
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45

*...skipping one line*
47
48
49
50
(50 rows)

Is this intended?

--
Regards,
vignesh
EnterpriseDB: http://www.enterprisedb.com

#2Thomas Munro
thomas.munro@gmail.com
In reply to: vignesh C (#1)
Re: psql ctrl+f skips displaying of one record and displays skipping one line

On Wed, Jul 17, 2019 at 4:07 PM vignesh C <vignesh21@gmail.com> wrote:

One observation when we execute a select query having results more than the screen space available and press ctrl+f to display the remaining records, one of the record was not displayed and the message "...skipping one line" was displayed.

I'm not sure if this is intentional behaviour.

Pretty sure this is coming from your system's pager. You can see the
same thing when you run this on a RHEL box:

seq 1 10000 | more

It skips a line each time you press ^F.

Doesn't happen on FreeBSD or macOS though.

--
Thomas Munro
https://enterprisedb.com

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Thomas Munro (#2)
Re: psql ctrl+f skips displaying of one record and displays skipping one line

Thomas Munro <thomas.munro@gmail.com> writes:

Pretty sure this is coming from your system's pager. You can see the
same thing when you run this on a RHEL box:
seq 1 10000 | more
It skips a line each time you press ^F.

Yeah, duplicated on RHEL6. It seems to behave the same as the documented
"s" command. Not sure why it's not listed in the man page --- though
there's a disclaimer saying that the man page was basically
reverse-engineered, so maybe they just missed this synonym.

Doesn't happen on FreeBSD or macOS though.

macOS's "more" is actually "less", so it's not surprising it's not
bug-compatible. Can't say about FreeBSD.

regards, tom lane

#4vignesh C
vignesh21@gmail.com
In reply to: Tom Lane (#3)
Re: psql ctrl+f skips displaying of one record and displays skipping one line

I'm able to get the same behaviour in centos as well.
Should we do anything to handle this in Postgres or any documentation
required?

On Wed, Jul 17, 2019 at 10:05 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:

Thomas Munro <thomas.munro@gmail.com> writes:

Pretty sure this is coming from your system's pager. You can see the
same thing when you run this on a RHEL box:
seq 1 10000 | more
It skips a line each time you press ^F.

Yeah, duplicated on RHEL6. It seems to behave the same as the documented
"s" command. Not sure why it's not listed in the man page --- though
there's a disclaimer saying that the man page was basically
reverse-engineered, so maybe they just missed this synonym.

Doesn't happen on FreeBSD or macOS though.

macOS's "more" is actually "less", so it's not surprising it's not
bug-compatible. Can't say about FreeBSD.

regards, tom lane

--
Regards,
vignesh
Have a nice day

#5Tom Lane
tgl@sss.pgh.pa.us
In reply to: vignesh C (#4)
Re: psql ctrl+f skips displaying of one record and displays skipping one line

vignesh C <vignesh21@gmail.com> writes:

I'm able to get the same behaviour in centos as well.
Should we do anything to handle this in Postgres or any documentation
required?

It already is documented:

PSQL_PAGER
PAGER

If a query's results do not fit on the screen, they are piped
through this command. Typical values are more or less. Use of the
pager can be disabled by setting PSQL_PAGER or PAGER to an empty
string, or by adjusting the pager-related options of the \pset
command. These variables are examined in the order listed; the
first that is set is used. If none of them is set, the default is
to use more on most platforms, but less on Cygwin.

We're certainly not going to copy four or five different versions
of the "more" and "less" man pages into psql's man page, if that's
what you're suggesting. Nor is it our job to point out shortcomings
in some versions of those man pages.

regards, tom lane

#6vignesh C
vignesh21@gmail.com
In reply to: Tom Lane (#5)
Re: psql ctrl+f skips displaying of one record and displays skipping one line

Thanks Tom.
That sounds good to me.

On Wed, Jul 17, 2019 at 10:17 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:

vignesh C <vignesh21@gmail.com> writes:

I'm able to get the same behaviour in centos as well.
Should we do anything to handle this in Postgres or any documentation
required?

It already is documented:

PSQL_PAGER
PAGER

If a query's results do not fit on the screen, they are piped
through this command. Typical values are more or less. Use of the
pager can be disabled by setting PSQL_PAGER or PAGER to an empty
string, or by adjusting the pager-related options of the \pset
command. These variables are examined in the order listed; the
first that is set is used. If none of them is set, the default is
to use more on most platforms, but less on Cygwin.

We're certainly not going to copy four or five different versions
of the "more" and "less" man pages into psql's man page, if that's
what you're suggesting. Nor is it our job to point out shortcomings
in some versions of those man pages.

regards, tom lane

--
Regards,
vignesh
Have a nice day