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?
Use \! cls to clear screen.
A view can be accessed as a virtual table in PostgreSQL. In other words, a PostgreSQL view is a logical table that represents data of one or more underlying tables through a SELECT statement. Notice that a view does not store data physically except for a materialized view.
psql returns 0 to the shell if it finished normally, 1 if a fatal error of its own occurs (e.g., out of memory, file not found), 2 if the connection to the server went bad and the session was not interactive, and 3 if an error occurred in a script and the variable ON_ERROR_STOP was set.
The PostgreSQL views are created using the CREATE VIEW statement. The PostgreSQL views can be created from a single table, multiple tables, or another view. CREATE [TEMP | TEMPORARY] VIEW view_name AS SELECT column1, column2..... FROM table_name WHERE [condition];
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With