6 ms·
> 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 s
by merb 8y ago
> 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.
o.O
I always tought the right way is CTRL+D.
- mey 8y agoAlso \q
- sin7 8y agoThis is how you quit.
- shrumm 8y agoCTRL + D is news to me, i’m a \q guy too.
- stingraycharles 8y agoCtrl+D is more generic, as it sends the signal to close the pipe (i.e. stdin from the perspective of psql).
- JimDabell 8y agoIt's a standard quit command for shells in UNIX – e.g. if you hit ^D in a Bourne shell it will exit as well.
- derefr 8y agoIt's not really a "command", though. Unlike, say, Ctrl+C, which becomes a SIGINT signal that the program receives and gets to decide how to handle, Ctrl+D never reaches the program as a separate recognizable thing that you can write a handler for. Instead, Ctrl+D is the way to ask the TTY driver to pass the program an EOF instead of input in response to its next read(2) call to its stdin. It's the same signal that the program would receive if you had been piping input into the program from a file, and that file reached the end. Thus, any CLI program built to handle being piped into, will "automatically" support Ctrl+D as a way to quit out of it.
- paulryanrogers 8y agoThis also works in Mysql.
- zitterbewegung 8y agoThey should have added !wq as a way to exit also.
- dean177 8y agoWhat else uses that?
- zitterbewegung 8y agoVi / vim.
- kwk1 8y agoYou probably meant `:wq!`.
- nickserv 8y agoOr !x for maximum efficiency ;-)
- wiz21c 8y agoC-x C-c is much better !
- kqr 8y agoNot too fr off if you, like me, prefer writing your SQL in sql-mode and have a comint buffer with psql you send your queries to!
- brian_herman 8y ago:D
- kelvich 8y agoSurprisingly highest voted question on stackoverflow about postgres is exactly "how to quit?" https://stackoverflow.com/questions/tagged/postgresql?sort=votes&pageSize=15 https://stackoverflow.com/questions/tagged/postgresql?sort=v...
- hinkley 8y agoEvery year I get to teach a handful of people about CTRL-Z. (CTRL-U is my favorite teletype command). We hardly ever get to CTRL-D.
- kqr 8y agoYou do know that doesn't actually terminate anything, right?
- hinkley 8y agoWhat, CTRL-Z? That’s the point. A couple minutes into a ten minute task someone goes whups I should have backgrounded that and they CTRL-C, up arrow, & and enter, and I say something like, “dude... we need to talk about CTRL-Z bg”
- noncoml 8y agoHope Mariadb gets a page out of their book and stops Ctrl-C from exiting their command-line tool.
- Shelnutt2 8y agoI can not wait for this to happen! Can be frustrating when you accidentally exit the client. A few months ago someone took a stab at it but its not been merged yet. https://github.com/MariaDB/server/pull/703 https://github.com/MariaDB/server/pull/703 https://lists.launchpad.net/maria-developers/msg11217.html https://lists.launchpad.net/maria-developers/msg11217.html https://jira.mariadb.org/browse/MDEV-14448 https://jira.mariadb.org/browse/MDEV-14448
- jeltz 8y agoI would argue CTRL+D is the right way since it works in almost all shells, and I am surprised not more people know it.
- majewsky 8y agoCtrl+D has a learning curve because its default meaning (i.e. when you're not messing with termios) is quite surprising. From `man tcsetattr`: > VEOF (004, EOT, Ctrl-D): End-of-file character (EOF). More precisely: this character causes the pending tty buffer to be sent to the waiting user program without waiting for end-of-line. If it is the first character of the line, the read(2) in the user program returns 0, which signifies end-of-file. Recognized when ICANON is set, and then not passed as input. In other words, most programs that exit upon Ctrl+D never see the Ctrl+D, they see an empty result from read() on stdin and interpret that as end-of-file. However, that only works when the tty buffer is empty. Try this: On a Unix shell, run `cat`, type something without pressing Enter, then press Ctrl-D instead.