title: Restore Postgres database using pg_restore over SSH
body: <p>I have a database server without much disk space, so I took a backup of the entire db (let's just call it redblue) and saved it locally using the following command (I don't have pg running on my computer):</p>
  
  <pre><code>ssh admin@w.x.y.z "pg_dump -U postgres redblue -h localhost " \
   &gt;&gt; db_backup_redblue.sql
  </code></pre>
  
  <p>I'd like to now restore it to another server (1.2.3.4) which contains an older version of "redblue" database - however wanted to ask if this is right before I try it:</p>
  
  <pre><code>ssh admin@1.2.3.4 "pg_restore -U postgres -C redblue" \
  &lt;&lt; db_backup_redblue.sql
  </code></pre>
  
  <p>I wasn't sure if I need to do -C with the name of the db or not? </p>
  
  <p>Will the above command overwrite/restore the remote database with the file I have locally?</p>
  
  <p>Thanks!</p>