ENG-5926 Add explicit sql casts to force type compatibility of inserted tuples.
(cherry picked from commit a6ece05d6869f0062ee6fc504fcf4bd2245eeb46)