View Single Post

   
  #1 (permalink)  
Old 05-05-2008, 06:53 AM
Alexy Khrabrov
 
Posts: n/a
Default numbering rows on import from file

Greetings -- I have a huge table of the form
(integer,integer,smallint,date). Its origin is an ASCII file which I
load with \copy. Now I want to number the rows, adding an id column
as an autoincrement from a sequence. How should I do the import now
for the sequence to work -- should I add the id column last, so it
will not be filled by copy and presumably autoincrement?

Or, once the table is already in, can I add a column and force it to
be filled with consecutive numbers, effectively numbering the rows?

Cheers,
Alexy

--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql

Reply With Quote