title: Behavior of Insert and Upsert in KDB
body: <p>I have following table:</p>
  
  <pre><code>           q) t:([s:`symbol$()] id:();id2:`int$())
  </code></pre>
  
  <p>where 's' is a primary key and 'id' col has general type.
  I am trying to understand following behavior when inserting a list (string in this ex.) in 'id' column:</p>
  
  <p>a) Upsert works but Insert fails</p>
  
  <pre><code>          q) `t insert (`a;"gg";4)     // 'type 
            q) `t upsert (`a;"gg";4)     // works
  </code></pre>
  
  <p>b) Insert requires primary key to be enlisted as well:</p>
  
  <pre><code>    q)`t insert  (`a;enlist "gg";4)    // 'length
  
      q)`t insert  (enlist `a;enlist "gg";4)  // works
  </code></pre>
  
  <p>What's going on behind the scene?</p>