sval: cast the return types before entering them into the database