title: How to create the equivalent of an SQL Server's identity column in Postgres
body: <p>There is an application which uses MSSQL as its back end. Now I am developing code so that it may use PostgreSQL. I have almost completed it except there is this one difference when executing:</p>
  
  <p><strong>When saving a new Application,</strong></p>
  
  <p>SQL Server code:</p>
  
  <pre><code>create table tower 
  (
    npages integer, 
    ifnds integer, 
    ifnid integer, 
    name varchar(20), 
    towid integer not null IDENTITY
  )
  </code></pre>
  
  <p>PostgreSQL code :</p>
  
  <pre><code>create table tower 
  (
    npages integer, 
    ifnds integer, 
    ifnid integer, 
    name varchar(20)
  )
  </code></pre>
  
  <p>Why doesn't the towid field (which is a default field) not get generated automatically when executing through PostgreSQL ?</p>
  
  <p>Any possible reason? Triggers? Procedures?</p>