Ending Postgres Query without leaving the command line - Get back to command line automatically
<p>Whenever I run a Postgres query it appears that you have to completely quit out of the command line.  </p>

<p>I have seen it done where you can press <code>CTRL-C</code> and you are taken back to the <code>PSQL</code> command line i.e., <code>databasename=&gt;</code>. Additionally, if I am in the middle of viewing results and I press <code>CTRL-C</code>, how can I have Postgres send me back to <code>databasename=&gt;</code>?  </p>

<p><strong>Bonus:</strong>  </p>

<p>Is there a way to script is so if I type usedb databasename folllwed by psql, Postgres will know which database I am referring to and automatically connect me to it so I dont have to type \connect databasename ?</p>