Create an unique integer id column for an existing string column
To add the new column use:

ALTER TABLE the_table ADD COLUMN id_int integer;


To populate the new column you need an UPDATE statement. 

I am assuming you have a primary key column named pk_column in your table. Obviously you need to replace that with the actual primary key column in your table.

update the_table
   set id_int = t.rn
from (
  select pk_column, 
         dense_rank() over (order by id_string) as rn
  from the_table
) t
where the_table.pk_column = t.pk_column;




If you really have a table without a primary key (why?), you can use the built-in ctid instead:

update the_table
   set id_int = t.rn
from (
  select ctid as id_, 
         dense_rank() over (order by id_string) as rn
  from the_table
) t
where the_table.ctid = t.id_;