Вопрос: Как выйти из утилиты командной строки PostgreSQL: psql


Какую команду или короткий ключ можно использовать для выхода из утилиты командной строки PostgreSQL psql?


1524


источник


Ответы:


Тип \qи затем нажмите ENTERуйти psql,


2189



Моя обычная последовательность клавиш:

quit()
quit
exit()
exit
q
q()
!q
^C
help
Alt + Tab
google.com
Quit PSQL
\q

Я думаю, что ветераны командной строки psql обычно сокращают это:

\q

596



Ctrl + D это то, что я обычно использую для выхода из консоли psql.


253



Для командной строки Linux \ д + войти.

Выход из Ctrl + D также есть работы


12



Try:

  • Ctrl+Z - this sends the TSTP signal (TSTP is short for “terminal stop”)
  • Ctrl+\ - this sends the QUIT signal

For curiosity:

  • Ctrl+D - this sends the EOF character. EOF stands for "end of file". In this concrete case it exits from the psql subprogram, as the shell is waiting for user input. This should not be 'the way to go' as it is not working if:
    • any other character is entered before - try entering some white spaces and then press Ctrl+D, it's not going to exit psql.
    • if the user input is not required at all

11



Based on PostgreSQL 11 Beta 1 Released!:

User Experience Enhancements

Another feature that fell into this category was the inability to intuitively quit from the PostgreSQL command-line (psql). There has been numerous recorded complaints of users trying to quit with the quit and exit commands, only to learn that the command to do so was \q.

We have heard your frustrations and have now added the ability to quit the command-line using the keywords quit and exit and hope that quitting a PostgreSQL session is now as enjoyable as using PostgreSQL.


4



I learned that I could include \q in a batch .sql file, so I could have psql quit earlier from an \i operation.


3



type \q + hit enter to restart psql type psql db_name


-1