Fixed CAST type for postgres compatibility.

Signed-off-by: Joseph Rézeau <moodle@rezeau.org>