numbering rows on import from file - Mailing list pgsql-sql

From Alexy Khrabrov
Subject numbering rows on import from file
Date
Msg-id F276B304-5080-42E6-ACF4-85C3499A8A00@gmail.com
Whole thread Raw
Responses Re: numbering rows on import from file  (chester c young <chestercyoung@yahoo.com>)
Re: numbering rows on import from file  ("Scott Marlowe" <scott.marlowe@gmail.com>)
Re: numbering rows on import from file  (Steve Crawford <scrawford@pinpointresearch.com>)
List pgsql-sql
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


pgsql-sql by date:

Previous
From: Alexy Khrabrov
Date:
Subject: Re: columns for count histograms of values
Next
From: chester c young
Date:
Subject: Re: numbering rows on import from file