I am going to change the data type of a column from “character varying” to “bigint” in postgre.
The old column contains string “male” and “female”, now I want to change it to 0 or 1, each representing male or female.
I think a simple Alter table … Alter Column does not solve this problem as it will not do the male -> 0, female -> 1 conversion.
Can anyone let me know what is the safest way to do this?
Many thanks.
Points to be considered
why do you want to use bigint datatype? BIT/TINYINT datatype will work
you need to update Male to 1 and Female to 0