Postgres datatype bugfix

Issue found while trying to upgrade the CMS using postgres.
A solution was found here: http://www.in-nomine.org/~asmodai/mysql-to-pgsql.html (section 6.3)