title: Is it possible to use multiple databases within same query using pg-promise?
body: <p>I have two related tables T1 and T2 in different databases D1 and D2. I need to do an inner join between two tables. </p>
  
  <p>From here: <a href="https://stackoverflow.com/questions/4678862/joining-results-from-two-separate-databases">Joining Results from Two Separate Databases</a> it is clear that separate queries should be made to two databases and results to be consolidated on client side OR use dblink / <a href="https://www.postgresql.org/docs/current/postgres-fdw.html" rel="nofollow noreferrer">postgres-fdw</a>.</p>
  
  <p>However, I see this issue: <a href="https://github.com/vitaly-t/pg-promise/issues/1" rel="nofollow noreferrer">Multiple Databases #1
  </a> and the use of <code>$dc</code> parameter here: <a href="http://vitaly-t.github.io/pg-promise/Database.html" rel="nofollow noreferrer">pg-promise/Database</a>.</p>
  
  <p>I believe issue: <a href="https://github.com/vitaly-t/pg-promise/issues/1" rel="nofollow noreferrer">Multiple Databases #1
  </a> just facilitates allowing connecting to multiple databases within the same codebase.</p>
  
  <p>The description of <code>$dc</code> parameter states:</p>
  
  <blockquote>
    <p>This is mainly to facilitate the use of multiple databases which may need separate protocol extensions, or different implementations within a single task</p>
  </blockquote>
  
  <p>However, I did not find any examples.</p>
  
  <p>Is the <code>$dc</code> paramter just a database context object that can be accessed, or would it allow to do an inner join between two different databases?</p>
  
  <p>Is there a way to do utilise two database connections but do a join across databases in without having to do it on client-side using <code>pg-promise</code>?</p>