Robert Morgan <robert_ (AT) ihug (DOT) co.nz> writes:
Quote:
Do I need to drop the existing column and create a new one using
create sequence.....? |
No, or at least not necessarily. You can create the sequence and then
alter the existing column definition to get its default value from
that sequence, for instance, suppose that your table name is foo and
the column's name is bar:
create sequence new_seq;
select setval('new_seq', select max(bar) from foo);
alter table foo alter column bar set default nextval(new_seq');
Regards,
Manuel.
---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match