From e03267ae4b253d6b542eabef5939ae12b7e6fc57 Mon Sep 17 00:00:00 2001 From: Andrew Hutchings Date: Wed, 3 May 2017 21:30:25 +0100 Subject: [PATCH] MCOL-697 Limit the return length for LONGBLOB For LONGBLOB the string return length was 4GB for functions which got converted to -1 and then to 20. This patch sets it to just under 2GB which we use for LONGBLOB everywhere else. --- dbcon/mysql/ha_calpont_execplan.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/dbcon/mysql/ha_calpont_execplan.cpp b/dbcon/mysql/ha_calpont_execplan.cpp index 536efe50a..8ffd82233 100755 --- a/dbcon/mysql/ha_calpont_execplan.cpp +++ b/dbcon/mysql/ha_calpont_execplan.cpp @@ -2233,7 +2233,15 @@ CalpontSystemCatalog::ColType colType_MysqlToIDB (const Item* item) break; case STRING_RESULT: ct.colDataType = CalpontSystemCatalog::VARCHAR; - ct.colWidth = item->max_length; + // MCOL-697 the longest TEXT we deal with is 2100000000 so + // limit to that. Otherwise for LONGBLOB ct.colWidth ends + // up being -1 and demons eat your data and first born + // (or you just get truncated to 20 bytes with the 'if' + // below) + if (item->max_length < 2100000000) + ct.colWidth = item->max_length; + else + ct.colWidth = 2100000000; // force token if (item->type() == Item::FUNC_ITEM) {