Possible Duplicate:
how to change column datatype from character to numeric in postgresql 8.4
If I have a field of type varchar (and all the values are null or string representations of numbers) how do I use alter table to convert this column type to bigint?
To convert simply by parsing the string (casting):
In fact, you can use any expression in terms of
the_columninstead ofthe_column::bigintto customise the conversion.Note this will rewrite the table, locking out even readers until it’s done.