The PostgreSQL Command Line Escape Room
Description
This image is a screenshot of a popular Stack Overflow post. The question at the top asks, 'How to exit from PostgreSQL command line utility: psql'. It has a high score of 1673. Below, an answer with 666 upvotes humorously lists a long sequence of failed attempts a developer might try: 'quit()', 'quit', 'exit()', 'exit', 'q', 'q()', '!q', '^C', 'help', 'Alt + Tab', 'google.com', 'Quit PSQL', and finally the correct command, '\q'. The answer concludes with the sarcastic remark, 'I think veterans of the psql command line usually shorten that to just: \q'. The joke resonates with developers because many command-line tools have non-obvious exit commands, and being 'trapped' in a program is a shared, frustrating experience. It's the PostgreSQL equivalent of the classic 'how to exit Vim' problem. The humor comes from the painful accuracy of the trial-and-error list, which captures the escalating desperation of a developer just trying to close a simple terminal session
Comments
8Comment deleted
There are only two states in a developer's life: not being in psql, and wondering how to get out of psql. It's the Hotel California of database CLIs
Spent an hour tuning autovacuum on a 20-node Postgres cluster, then another hour figuring out how to exit psql - turns out the real single point of failure was me not typing “\q”
The only database where the hardest query is SELECT * FROM exit_strategies;
Every REPL has its own exit incantation, which is why senior engineers don't quit psql - they just open a new terminal and let the old session become infrastructure
The progression from 'quit()' to 'Alt + Tab' to 'google.com' perfectly captures the five stages of CLI grief. Every senior engineer has been there - frantically trying every conceivable exit command while that blinking cursor mocks your decades of experience. The real veterans know: it's always the backslash command you'd never guess, and you'll Google it at least three times before muscle memory finally kicks in. At least it's not as bad as trying to exit Vim on your first day
psql is the only REPL where the escape character is literally how you escape: \q - proof we standardized SQL, not quitting; my fingers still cycle through :q, ^C, and exit()
\q: The backslash that liberates more DBAs than Kubernetes ever will, yet eludes every ORM evangelist
Seniority is when your fingers skip quit, exit, and :q and go straight to \q - wisdom earned during too many 3am psql restores