title: trying to restore a production postgresql db into dev box
body: <p>I'm running the following command to create a dump of all database on my production server: </p>
  
  <pre><code>prodserver:/# pg_dumpall -U postgres -h 1.1.1.1 &gt; prod.sql
  </code></pre>
  
  <p>on my development box, I also take a backup by doing:</p>
  
  <pre><code>devserver:/# pg_dumpall -U postgres -h 1.1.1.1 &gt; dev.sql
  </code></pre>
  
  <p>Then I try to restore the production database on to development like so: </p>
  
  <pre><code>devserver:/# psql -f prod.sql -U postgres
  </code></pre>
  
  <p>It runs with no errors. And it appears to be creating tables /import data.  I know because if I run it a second time, I get messages that certain data already exists / relationships already exist.</p>
  
  <p>But when I log in like so: </p>
  
  <pre><code>psql -U postgres -d databasename
  </code></pre>
  
  <p>the data looks the same as the old dev data.  I tried the following with the production data supposedly restored:</p>
  
  <pre><code>select count(*) from widgets; 
  </code></pre>
  
  <p>I compare that with the count returned when I'm using the development database and they are the same. 
  It looks like the database wasn't restored properly.</p>
  
  <p>Do I have to:</p>
  
  <ul>
  <li>a) delete the dev databsae before I restore production?  </li>
  <li>b) restart
  postgresql?</li>
  </ul>
  
  <p>I've been using <a href="http://www.postgresql.org/docs/9.1/static/app-pg-dumpall.html" rel="nofollow">http://www.postgresql.org/docs/9.1/static/app-pg-dumpall.html</a> as a guide... 
  I was referring to the examples at the bottom of the page. </p>
  
  <p>Any suggestions on what I might be doing wrong would be appreciated. </p>
  
  <p>Thanks. </p>
  
  <p><strong>EDIT 1</strong></p>
  
  <p>I also checked the following: </p>
  
  <p>I opened up the prod.sql file and found insert statements like: </p>
  
  <pre><code>INSERT INTO widgets_to_wiget_groups VALUES (363, 15);
  </code></pre>
  
  <p>And then I did a select statement on the database to see if I had this entry in the table but I don't... maybe it's restoring it but under the context of another user?</p>