Robert --
>Hi,
>
>
>I have a column in a table called hist_id with the datatype "integer". When I created the table I assigned this column
theprimary key constraint but didn´t make it an auto-increment column.
>
>
>How could I do this to an the already existing column?
>
>
>I have created the sequence with the following command but don´t know how to change the existing column to
auto-increment.
>
>
>
>
>$ create sequence hist_id_seq;
>
Perhaps:
ALTER TABLE history_foo ALTER COLUMN hist_id SET DEFAULT nextval('hist_id_seq');
?? (untested)
You may need to to update the sequence to reflect your current highest value for hist_id (or whatever the column is --
setthe sequence using select setval('hist_id_seq', maxid) so that the next value you get from the sequence doesn't
collidewith existing values.
HTH,
Greg Williamson