Well, I suppose you could create a new sequence, set it's starting value
to be higher than any key in the PK field already, and add a default to
that column of nextval('my_new_seq'). The docs for 'create sequence'
should be a good place to start.
With a little extra elbow grease you can copy, drop and recreate the
table while massaging the existing PK's to start at 1 and count up, then
create the sequence as described above, if you really want an orderly PK
field.
-Fran
webmaster wrote:
> Does any one know if I can alter the primary key of a table to an
> integer that automatically increases each time a value is added? Thanks
> for any help. Or do I have to delete the table and create a new one?
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org