title: join on two databases using postgresql and dblink
body: <p>I have the following databases:</p>
  
  <pre><code>server_a {
      a_t1 (a_t1_a1, a_t1_a2);
      a_t2 (a_t2_a1, a_t2_a2);
  }
  server_b {
      b_t1 (b_t1_a1, b_t1_a2);
      b_t2 (b_t2_a1, b_t2_a2);
  }
  
  attribute 1 = serial not null (primary)
  attribute 2 = character varying(50)
  </code></pre>
  
  <p>I have to Join a table in the first to the second database</p>
  
  <p>Here is the sql i have presumed:</p>
  
  <pre><code>Select * from a_t1 full outer join dblink('dbname=server_b','select * from b_t1') 
  where a_t1.a_t1_a1&gt;1
  </code></pre>
  
  <p>however i am getting this error:</p>
  
  <pre><code>ERROR:  syntax error at or near "where"
  LINE 1: ...in dblink('dbname=server_b','select * from b_t1') where a_t1...
                                                               ^
  ********** Error **********
  
  ERROR: syntax error at or near "where"
  SQL state: 42601
  Character: 83
  </code></pre>