title: SQL: Change data type of a column from String to Numeric
body: <p>I am going to change the data type of a column from "character varying" to "bigint" in postgre.</p>
  
  <p>The old column contains string "male" and "female", now I want to change it to 0 or 1, each representing male or female.</p>
  
  <p>I think a simple Alter table ... Alter Column does not solve this problem as it will not do the male -> 0, female -> 1 conversion.</p>
  
  <p>Can anyone let me know what is the safest way to do this?</p>
  
  <p>Many thanks.</p>