I have a table1 with column 'abc' with type as character varying I want it to be modified to bigint. The column values should be replaced with a value from external table like a foreign key reference, i.e id corresponding to entry of this value in table2 How can i do it? My attempt was :
ALTER TABLE table1 ALTER COLUMN abc TYPE bigint USING SELECT some_id from table2 where col1=abc