Someone needed to add a serial type to a table. Here's the quick dirty,
lazy dba way:
say table t1 has a structure like so:
create table t1 (field1 text, id int);
and data in it, and we want id to be a serial (autoincrementing etc...)
field.
do this:
create table t2 (field1 text, id serial);
Now, assuming that all the data in t1 has a unique id, we can just do
this:
insert into t2 (select * from t1);
and voila, our table is populated. One small problem, the current value
of the associate sequence is still set to the original number (1 I think).
So, we do this:
select setval('t2_id_seq',(select max(id) from t2));
And now we have our sequence ready to go.
Good luck!