title: Cross database query using dblink
body: <p>I'd like to use dblink in postgres to copy data from a local database to a remote one. This what I came up with:</p>
  
  <p><code>SELECT * FROM dblink('archive', 'INSERT INTO data SELECT * FROM local.data')</code></p>
  
  <p>It wont work and I think I understand why. I get the error <code>relation "local.data" does not exist</code>, If possible, Id like to run this inside a stored procedure on the local database, in other words I want to push the data to the 'archive' server, rather than pull it to the 'archive'.</p>
  
  <p>How can I tell postgres to look in the local database? How can I address the local database from inside the dblink query?</p>