I have an existing table with records in it and I've just added a new column ver
which I would like to be unique.
create table foo (
bar text,
ver integer
);
select * from foo;
bar ver
--- ---
one null
two null
three null
I'm struggling with how to do this for some reason.
I want to do something like:
update foo set ver = ( select generate_series(1, 1000) );
or maybe
update foo set ver = v from (select generate_series(1, 1000) as v );
...but of course neither of those work. Can anyone point out the obvious for me?