Thursday, April 14, 2022

[SOLVED] How to exit from query result viewer in psql?

Issue

First query:

database=# select * from table limit 1;
...
 |
(1 row)

(END)

I want to make a second query but I can't. ctrl+Z exits from psql. What can I press to exit only from result viewing?


Solution

Hit q. This closes many vim-like views, not only in psql, but also e.g. in 'less', 'git log', 'mutt', and many more.

Just FYI: Hitting Ctrl + Z does not exit psql, it just suspends it and sends it to background. The program continues to run, and you can resume it by entering 'fg'. In Unix environments, Ctrl + C is usually the way to forcibly stop a program.



Answered By - andreas-hofmann
Answer Checked By - Mildred Charles (WPSolving Admin)