title: Strange DB2 Scopes
body: <p>Create two tables with some ids overlapping.</p>
  
  <pre><code>create table outer_table (
      id integer,
      overlap_in smallint default 0
  );
  create table inner_table (
      inner_id integer
  );
  </code></pre>
  
  <p>Next, populate them with ids, some common.</p>
  
  <pre><code>insert into outer_table(id) values 0, 1, 2, 3, 4, 5, 6, 7, 8, 9;
  insert into inner_table(inner_id) values 0, 1, 2;
  </code></pre>
  
  <p>Next, update the overlap indicator. BUT, by mistake, you type in the wrong column name, you write just "id" instead of "inner_id", and you decide not to use an alias.</p>
  
  <pre><code>update outer_table o
  set o.overlap_in = 1
  where o.id in (select id from inner_table);
  </code></pre>
  
  <p>The result:</p>
  
  <ol>
  <li>No SQL errors</li>
  <li>It update overlap_in field to 1 in all rows in outer_table </li>
  </ol>
  
  <p>How is this even normal? Any explanations why db2 allows this?</p>
  
  <p>Note: DB2 Version: </p>
  
  <pre><code>&gt;db2level
  DB21085I  Instance "....." uses "64" bits and DB2 code release "SQL09075"
  with level identifier "08060107".
  Informational tokens are "DB2 v9.7.0.5", "...", "IP23285", and Fix Pack
  "5".
  </code></pre>