From 9bd4255021fbdb80e81005d36b8abe3c306e4c45 Mon Sep 17 00:00:00 2001 From: David Hall Date: Wed, 24 Jun 2020 15:18:03 -0500 Subject: [PATCH] MCOL-4099 Fix up first char insertion --- utils/funcexp/func_insert.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/funcexp/func_insert.cpp b/utils/funcexp/func_insert.cpp index a869ef4bf..8e5864433 100644 --- a/utils/funcexp/func_insert.cpp +++ b/utils/funcexp/func_insert.cpp @@ -73,8 +73,6 @@ std::string Func_insert::getStrVal(rowgroup::Row& row, if (isNull) return ""; - start--; // Because SQL syntax is 1 based and we want 0 based. - CHARSET_INFO* cs = fp[0]->data()->resultType().getCharset(); // binLen represents the number of bytes @@ -91,6 +89,8 @@ std::string Func_insert::getStrVal(rowgroup::Row& row, if ((length < 0) || (length > strLen)) length = strLen; + start--; // Because SQL syntax is 1 based and we want 0 based. + // Convert start and length from characters to bytes. start = cs->charpos(pos, end, start); length = cs->charpos(pos+start, end, length);