Remove function call w/ unused result
Replace to_char() call with explicit cast

In postgresql, to_char() does not exist in the variant implied by the
code.