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.
Merge remote-tracking branch 'refs/remotes/github/core-integration' into ImperialBranch