HHH-9138 - CastFunctionTest failing on most databases

(cherry picked from commit c012c4d8de9aa68f42fed067184d2520594013d5)