diff --git a/src/common/cvt.cpp b/src/common/cvt.cpp index 55cd17f659..52cbc09218 100644 --- a/src/common/cvt.cpp +++ b/src/common/cvt.cpp @@ -1789,11 +1789,12 @@ void CVT_move_common(const dsc* from, dsc* to, DecimalStatus decSt, Callbacks* c ptr += sizeof(USHORT); Jrd::CharSet* charSet = cb->getToCharset(to->getCharSet()); + UCHAR maxBytesPerChar = charSet ? charSet->maxBytesPerChar() : 1; - if (len / charSet->maxBytesPerChar() < from->dsc_length) + if (len / maxBytesPerChar < from->dsc_length) { cb->err(Arg::Gds(isc_arith_except) << Arg::Gds(isc_string_truncation) << - Arg::Gds(isc_trunc_limits) << Arg::Num(len / charSet->maxBytesPerChar()) << + Arg::Gds(isc_trunc_limits) << Arg::Num(len / maxBytesPerChar) << Arg::Num(from->dsc_length)); } @@ -2107,6 +2108,8 @@ void CVT_conversion_error(const dsc* desc, ErrorFunction err) message = "ARRAY"; else if (desc->dsc_dtype == dtype_boolean) message = "BOOLEAN"; + else if (desc->dsc_dtype == dtype_dbkey) + message = "DBKEY"; else { // CVC: I don't have access here to JRD_get_thread_data())->tdbb_status_vector