Обсуждение: What is paging my psql
Hi guys.
I have virtually identical 3 servers and one is paging the output.
-> $ psql --port=5437 -c '\pset pager'
Pager usage is off.
there is no PAGER nor any other, obvious OS evn var set, yet I do simple query which shows a few lines, eg.
-> $ psql --port=5437 --dbname=upa_discourse -c 'select * from pg_extension;'
and the output is paged, waiting for 'q' from user to go back to shell.
I could not find any psqlrc neither - and the other two servers do not that, to make more bizarre.
Would you know where is it coming from and how to fix it permanently - ideally not by adding stuff but by figuring out why it is the two servers do page and then fixing the odd one same way.
I'm on Ubuntu 22.04 with ver 16 of PG.
thanks, L.
I have virtually identical 3 servers and one is paging the output.
-> $ psql --port=5437 -c '\pset pager'
Pager usage is off.
there is no PAGER nor any other, obvious OS evn var set, yet I do simple query which shows a few lines, eg.
-> $ psql --port=5437 --dbname=upa_discourse -c 'select * from pg_extension;'
and the output is paged, waiting for 'q' from user to go back to shell.
I could not find any psqlrc neither - and the other two servers do not that, to make more bizarre.
Would you know where is it coming from and how to fix it permanently - ideally not by adding stuff but by figuring out why it is the two servers do page and then fixing the odd one same way.
I'm on Ubuntu 22.04 with ver 16 of PG.
thanks, L.
On Thursday, November 20, 2025, lejeczek <peljasz@yahoo.co.uk> wrote:
I have virtually identical 3 servers and one is paging the output.
-> $ psql --port=5437 -c '\pset pager'
Pager usage is off.
You just demonstrated that the psql running on this client uses the pager by default. Since by executing pset pager you turned it off.
The server being connected to should not play a role. You’ll need a better example if you claim otherwise.
David J.
On Thu, 2025-11-20 at 15:16 +0100, lejeczek wrote: > I have virtually identical 3 servers and one is paging the output. > > Would you know where is it coming from and how to fix it permanently It is probably on by default. Set the environment variable PAGER to an empty string. Yours, Laurenz Albe
All three servers show the same:
-> $ psql --port=5437 -c '\pset' | egrep -i pager
pager 1
pager_min_lines 0
Two of them do not page the query I showed
-> $ psql --port=5438 --dbname=yja_discourse -c 'select * from pg_extension;'
oid | extname | extowner | extnamespace | extrelocatable | extversion | extconfig | extcondition
-------+----------+----------+--------------+----------------+------------+-----------+--------------
13545 | plpgsql | 10 | 11 | f | 1.0 | |
16393 | hstore | 10 | 2200 | t | 1.8 | |
16521 | pg_trgm | 10 | 2200 | t | 1.6 | |
16602 | unaccent | 10 | 2200 | t | 1.1 | |
61507 | vector | 10 | 2200 | t | 0.8.1 | |
(5 rows)
third server pages - waits for user 'q' to switch back to shell prompt.
None of the servers - no that I could find - has $PAGER nor $PSQL_PAGER nor $SYSTEMD_PAGER set.
In fact:
-> $ set | egrep -i page
-> $ env | egrep -i page
shows nothing.
None of the servers - I failed to find - has psqlrc, not for the user nor system-wide.
On the two non-paging servers with this:
-> $ psql --port=5437 -c '\pset pager on'
Pager is used for long output.
done, the above query does not page - for the output is not long enough I believe.
On the third paging server - that does not change behaviour neither.
But I also noticed that after 'on/off' - this does not change and remains:
-> $ psql --port=5437 -c '\pset' | egrep -i pager
pager 1
pager_min_lines 0
Should that change/setting not be permanent, at least for the session-time being?
thanks, L.
neither any shell aliases involving psql exist
On Friday, November 21, 2025, lejeczek <peljasz@yahoo.co.uk> wrote:
All three servers show the same:
-> $ psql --port=5437 -c '\pset' | egrep -i pager
pager 1
pager_min_lines 0
Everything seems to be working as intended. You just seem to have incorrect expectations.
Whether the pager is used is conditioned on actual output data.
pset controls client settings and those are never “saved”. They have their default values and a psqlrc file if you wish to change them during program startup.
David J.
"David G. Johnston" <david.g.johnston@gmail.com> writes:
> Whether the pager is used is conditioned on actual output data.
IIRC, you can do "\pset pager always" if you want the pager to be
invoked regardless of the query output length.
Be aware though that the default pager is "more", which (at least
on my Linux box) silently does nothing special if the output is less
than a screenful. If the behavior you are looking for is "wait for
a keystroke even after very short output", you'd need to combine the
\pset setting with "export PSQL_PAGER=less" or similar.
regards, tom lane
gee zuss boy...
I at this point begin to wonder if you guys - those who replied - even read what I/people say or.. you just take the piss.
I've only been trying to show that three boxes I have, with virtually the same settings, same env, same (absent!) shell vars, behave differently when they show _same_ output for the _same_ simple query.
What expectations? expectations about what?
I'm only trying to investigate & understand why that is that one box does - what I under is "paging" of a short output - whereas other two do _not_ that.
The _but_ here is - obviously - that between that 1 box VS 2 other boxes, there must be a difference(s) somewhere... but ! where?
thanks, L.
I at this point begin to wonder if you guys - those who replied - even read what I/people say or.. you just take the piss.
I've only been trying to show that three boxes I have, with virtually the same settings, same env, same (absent!) shell vars, behave differently when they show _same_ output for the _same_ simple query.
What expectations? expectations about what?
I'm only trying to investigate & understand why that is that one box does - what I under is "paging" of a short output - whereas other two do _not_ that.
The _but_ here is - obviously - that between that 1 box VS 2 other boxes, there must be a difference(s) somewhere... but ! where?
thanks, L.
lejeczek <peljasz@yahoo.co.uk> writes:
> I've only been trying to show that three boxes I have, with
> virtually the same settings, same env, same (absent!) shell
> vars, behave differently when they show _same_ output for
> the _same_ simple query.
[ shrug... ] So there is something different about those boxes.
We have less information about that than you do. Have you
checked ~/.psqlrc on all three?
regards, tom lane
On Friday, November 21, 2025, lejeczek <peljasz@yahoo.co.uk> wrote:
I'm only trying to investigate & understand why that is that one box does - what I under is "paging" of a short output - whereas other two do _not_ that.
The _but_ here is - obviously - that between that 1 box VS 2 other boxes, there must be a difference(s) somewhere... but ! where?
I guess I’m not trying to walk you through debugging and diagnostics at this point because this doesn’t seem like a bug. So yes, I’ve have been unable to completely understand the issue because it is not being presented in a complete manner. It would be better to pick a single one that is “wrong”, fully show and describe what you are doing and what you expect to happen (and ideally why), and basically treat it like a bug report. Asking us to compare to behaviors that aren’t related to PostgreSQL version is hit-or-miss. On that note, what is the version or versions of the psql client involved here?
Since psql is a CLI not mentioning which terminal and/or shells are in use, or OS, is a major omission here.
David J.
On Friday, November 21, 2025, David G. Johnston <david.g.johnston@gmail.com> wrote:
Since psql is a CLI not mentioning which terminal and/or shells are in use, or OS, is a major omission here.
Ok, I found the versioning info. My bad.
David J.
On Fri, Nov 21, 2025 at 2:15 PM David G. Johnston <david.g.johnston@gmail.com> wrote:
On Friday, November 21, 2025, lejeczek <peljasz@yahoo.co.uk> wrote:I'm only trying to investigate & understand why that is that one box does - what I under is "paging" of a short output - whereas other two do _not_ that.
The _but_ here is - obviously - that between that 1 box VS 2 other boxes, there must be a difference(s) somewhere... but ! where?I guess I’m not trying to walk you through debugging and diagnostics at this point because this doesn’t seem like a bug. So yes, I’ve have been unable to completely understand the issue because it is not being presented in a complete manner. It would be better to pick a single one that is “wrong”, fully show and describe what you are doing and what you expect to happen (and ideally why), and basically treat it like a bug report. Asking us to compare to behaviors that aren’t related to PostgreSQL version is hit-or-miss. On that note, what is the version or versions of the psql client involved here?Since psql is a CLI not mentioning which terminal and/or shells are in use, or OS, is a major omission here.
http://www.catb.org/~esr/faqs/smart-questions.html used to be the go-to link, and should be again.
Death to <Redacted>, and butter sauce.
Don't boil me, I'm still alive.
<Redacted> lobster!