I am working with a postgresql database that has two columns. One for an ip address and another for the netmask. Both of these columns are char varying(30). I would like to convert to just one column as inet. Any one know a slick way to convert the dotted quad netmask, E.G. 255.255.128.0, to number of bits. I didn't see any way directly looking at the network functions in the PG documentation.