title: How to merge two tables in postgresql when one of them is missing just one column?
body: <p>Here's the thing, I have table_1:</p>
  <pre><code>id    col1    col2
  A     10      20
  B     15      30
  C     5       15
  </code></pre>
  <p>And table_2:</p>
  <pre><code>id    col1    
  A     10      
  A     10          
  D     15 
  D     15    
  E     25
  E     25      
  </code></pre>
  <p>I want to input on table_1 everything there is on table_2 and it's not on table_1. This is the result I'm looking for:</p>
  <pre><code>id    col1    col2
  A     10      20
  B     15      30
  C     5       15
  D     15      0
  E     25      0
  </code></pre>
  <p>id and col1 have unique values, I mean, they might appear more than once on table_2, but they will appear with the same value.</p>
  <p>UNION and UNION ALL will not work. Left or Right join also doesn't make sense. So I have no idea on how to do this.</p>
  <p>If you do something like:</p>
  <pre><code>select * from table_1
  union
  select * from (select distinct id, col1, 0 as col2 from table_2)
  </code></pre>
  <p>You will get id A duplicated. So this doesn't work as well.</p>