title: How to add ROW_NUMBER() in a view?
body: <p>In PostgreSQL 8.4 I want to create a view from 3 tables with id. So I want to have this structure in my view:</p>
  
  <pre><code>num serial,
  name_dispatcher character varying(250)
  the_geom geometry
  </code></pre>
  
  <p>I can select <code>name_dispatcher</code> and <code>the_geom</code> from tables:</p>
  
  <pre><code> CREATE VIEW lineView
        AS SELECT 'name' AS name_dispatcher, the_geom
        FROM line1
        UNION
        SELECT 'name' AS name_dispatcher, the_geom
        FROM line2
        UNION
        SELECT 'name' AS name_dispatcher, the_geom
        FROM line3
  </code></pre>
  
  <p>How to create the <code>num</code> column in the view?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I found a solution:</p>
  
  <pre><code>ROW_NUMBER() OVER(ORDER BY lineView.voltage)
  </code></pre>
  
  <p>But I don't know how to use it in <code>ALTER VIEW</code>. How do I put it in there?</p>