How to exit from PostgreSQL command line utility: psql

前端 未结 9 1187
小鲜肉
小鲜肉 2020-12-02 03:22

What command or short key can I use to exit the PostgreSQL command line utility psql?

相关标签:
9条回答
  • 2020-12-02 03:42

    Type \q and then press ENTER to quit psql.

    UPDATE: 19-OCT-2018

    As of PostgreSQL 11, the keywords "quit" and "exit" in the PostgreSQL command-line interface have been included to help make it easier to leave the command-line tool.

    0 讨论(0)
  • 2020-12-02 03:52

    My usual key sequence is:

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

    I think veterans of the psql command line usually shorten that to just:

    \q
    
    0 讨论(0)
  • 2020-12-02 03:55

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

    0 讨论(0)
  • 2020-12-02 03:56

    For Linux command line \q + enter.

    Quiting with Ctrl + D also is works

    0 讨论(0)
  • 2020-12-02 03:58

    Actually, \q, exit and CTRL + D did'nt worked for me to exit from the psql program.

    Ctrl + Shift + D
    

    Worked for me. Hope it ll help someone :)

    My ubuntu version is 19.04

    0 讨论(0)
  • 2020-12-02 04:01

    quit or exit or \q

    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.

    0 讨论(0)
提交回复
热议问题