Articles

Affichage des articles du novembre, 2009

postgres casting text to integer

If you want to cast a text field to integer, but some of your records are empty, here is a solution to avoid the : invalid input syntax for integer: '' error. Simply put a '0' at the beginning of your cast like this : ('0' || text_field)::integer. All empty fields will be equal to 0, and the others begins with 0 and convert without any problem to integer.

Chrome OS

I don't know if this will be the next big thing, but it's kicking fast. See http://www.youtube.com/watch?v=HBH0cX98F3Q