Bug #88017 Column Comments incorrectly truncated
Submitted: 6 Oct 2017 22:32 Modified: 9 Oct 2017 8:03
Reporter: Sam Abboushi Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Workbench Severity:S3 (Non-critical)
Version:6.3.9 CE (64 bits) OS:Microsoft Windows (10 Pro)
Assigned to: CPU Architecture:Any
Tags: column comments, truncated

[6 Oct 2017 22:32] Sam Abboushi
Description:
Column comments truncate incorrectly

How to repeat:
========================================================================
TEST STRING (1024 characters between quotes including line terminators): 
========================================================================
"11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111>100
22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222>200
33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333>300
44444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444>400
55555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555>500
66666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666>600
77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777>700
88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888>800
99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999>900
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000>1000
1111111111111111111>1024"

No problem adding this Column comment per Script created by Workbench:

ALTER TABLE `test`.`test_column_comments_truncated` 
CHANGE COLUMN `col1` `col1` INT(11) NOT NULL COMMENT '11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111>100\n22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222>200\n33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333>300\n44444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444>400\n55555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555>500\n66666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666>600\n77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777>7000\n88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888>800\n99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999>900\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000>1000\n111111111111111111>1024' ;

========================================================================
---SCENARIO 1---
========================================================================
Add 'X' at the end (i.e. now 1025 characters):
Correctly truncates per Script created by Workbench:
ALTER TABLE `test`.`test_column_comments_truncated` 
CHANGE COLUMN `col1` `col1` INT(11) NOT NULL COMMENT '11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111>100\n22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222>200\n33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333>300\n44444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444>400\n55555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555>500\n66666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666>600\n77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777>7000\n88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888>800\n99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999>900\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000>1000\n111111111111111111>1024' /* comment truncated */ /*X*/ ;

So far, so good: /* comment truncated */ /*X*/

========================================================================
---SCENARIO 2---
========================================================================
Type <ENTER> after ">600" (i.e. now 1025 characters):

Seems it incorrectly truncates to 604 characters per Script created by 

Workbench:
ALTER TABLE `test`.`test_column_comments_truncated` 
CHANGE COLUMN `col1` `col1` INT(11) NOT NULL COMMENT '11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111>100\n22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222>200\n33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333>300\n44444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444>400\n55555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555>500\n66666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666>600' /* comment truncated */ /*
77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777>700
88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888>800
99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999>900
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000>1000
1111111111111111111>1024*/ ;

Seems it does not report on the first "\n" that was truncated (there were 2: "\n\n777...")

========================================================================
---SCENARIO 3---
========================================================================
TEST STRING (1543 characters between quotes including line terminators):
"10/6/2017 11:54AM:
Need to self-join table.
Combining multiple qortbl2 words to match up with one quran.word word:
---------------t1-----------------------		------------------t2------------------
SVWunion	wordPhonetic		qortbl2_wordSVW	qortbl2word
109:1:1		qul			109:1:1	 	qul
109:1:2	 	yāayyuhā		109:1:2	 	yaa
109:1:3	 	l-kāfirūna			109:1:2	 	'ayy-u-haa
109:1:4	 				109:1:3	 	l-kaafir-uuna

SELECT 
   t1.SVWunion,
   t1.wordPhonetic,
GROUP_CONCAT(t2.qortbl2word SEPARATOR '\n') AS UofHaifaTranscription
FROM
   quran.svw_union_word_qortbl2 AS t1
RIGHT JOIN  -- ignores row 109:1:4 in t1
   quran.svw_union_word_qortbl2 AS t2
ON
   t1.SVWunion = t2.qortbl2_wordSVW
WHERE
   t2.qortbl2_wordSVW IS NOT NULL
GROUP BY
   t2.qortbl2_wordSVW
ORDER BY
   t1.ID;

Listing one qortbl2 word multiple times i.e. multiple quran.word words are combined to form one qortbl2 word:
--------------------------------t1----------------------------------			--------------t2----------------------
SVWunion	wordPhonetic	word_qortbl2SVW			SVWunion	qortbl2word
101:10:1		wamā	 	101:10:1				101:10:1	 	wa-maa
101:10:2		adrāka	 	101:10:2				101:10:2	 	'adraa-ka
101:10:3		mā	 	101:10:3				101:10:3	 	maahiyah
101:10:4		hiyah	 	101:10:3				101:10:4	 

SELECT 
	t1.SVWunion,
	t1.wordPhonetic,
	t2.qortbl2word AS UofHaifaTranscription
FROM
   quran.svw_union_word_qortbl2 AS t1
LEFT JOIN
   quran.svw_union_word_qortbl2 AS t2
ON
   t1.word_qortbl2SVW = t2.SVWunion
WHERE
   t1.word_qortbl2SVW IS NOT NULL
ORDER BY
   t1.ID;"

Seems it incorrectly truncates to 386 characters per Script created by Workbench:

ALTER TABLE `test`.`test_column_comments_truncated` 
CHANGE COLUMN `col1` `col1` INT(11) NOT NULL COMMENT '10/6/2017 11:54AM:\nNeed to self-join table.\nCombining multiple qortbl2 words to match up with one quran.word word:\n---------------t1-----------------------		------------------t2------------------\nSVWunion	wordPhonetic		qortbl2_wordSVW	qortbl2word\n109:1:1		qul			109:1:1	 	qul\n109:1:2	 	yāayyuhā		109:1:2	 	yaa\n109:1:3	 	l-kāfirūna			109:1:2	 	\'ayy-u-haa\n109:1:4	 				109:1:3	 	l-kaafir-' /* comment truncated */ /*una

SELECT 
   t1.SVWunion,
   t1.wordPhonetic,
GROUP_CONCAT(t2.qortbl2word SEPARATOR '\n') AS UofHaifaTranscription
FROM
   quran.svw_union_word_qortbl2 AS t1
RIGHT JOIN  -- ignores row 109:1:4 in t1
   quran.svw_union_word_qortbl2 AS t2
ON
   t1.SVWunion = t2.qortbl2_wordSVW
WHERE
   t2.qortbl2_wordSVW IS NOT NULL
GROUP BY
   t2.qortbl2_wordSVW
ORDER BY
   t1.ID;

Listing one qortbl2 word multiple times i.e. multiple quran.word words are combined to form one qortbl2 word:
--------------------------------t1----------------------------------			--------------t2----------------------
SVWunion	wordPhonetic	word_qortbl2SVW			SVWunion	qortbl2word
101:10:1		wamā	 	101:10:1				101:10:1	 	wa-maa
101:10:2		adrāka	 	101:10:2				101:10:2	 	'adraa-ka
101:10:3		mā	 	101:10:3				101:10:3	 	maahiyah
101:10:4		hiyah	 	101:10:3				101:10:4	 

SELECT 
	t1.SVWunion,
	t1.wordPhonetic,
	t2.qortbl2word AS UofHaifaTranscription
FROM
   quran.svw_union_word_qortbl2 AS t1
LEFT JOIN
   quran.svw_union_word_qortbl2 AS t2
ON
   t1.word_qortbl2SVW = t2.SVWunion
WHERE
   t1.word_qortbl2SVW IS NOT NULL
ORDER BY
   t1.ID;*/ ;

Seems it does not report on the first "u" that was truncated (there were 2: "uuna\n\n")

========================================================================
---SCENARIO 4---
========================================================================
TEST STRING (The first 1020 characters of previous test string):

"10/6/2017 11:54AM:
Need to self-join table.
Combining multiple qortbl2 words to match up with one quran.word word:
---------------t1-----------------------		------------------t2------------------
SVWunion	wordPhonetic		qortbl2_wordSVW	qortbl2word
109:1:1		qul			109:1:1	 	qul
109:1:2	 	yāayyuhā		109:1:2	 	yaa
109:1:3	 	l-kāfirūna			109:1:2	 	'ayy-u-haa
109:1:4	 				109:1:3	 	l-kaafir-uuna

SELECT 
   t1.SVWunion,
   t1.wordPhonetic,
GROUP_CONCAT(t2.qortbl2word SEPARATOR '\n') AS UofHaifaTranscription
FROM
   quran.svw_union_word_qortbl2 AS t1
RIGHT JOIN  -- ignores row 109:1:4 in t1
   quran.svw_union_word_qortbl2 AS t2
ON
   t1.SVWunion = t2.qortbl2_wordSVW
WHERE
   t2.qortbl2_wordSVW IS NOT NULL
GROUP BY
   t2.qortbl2_wordSVW
ORDER BY
   t1.ID;

Listing one qortbl2 word multiple times i.e. multiple quran.word words are combined to form one qortbl2 word:
--------------------------------t1----------------------------------			--------------t2----------------------
SVWunion	wordPhonetic	word_qortbl2SVW			SVW"

No problem adding this Column comment per Script created by Workbench:
ALTER TABLE `test`.`test_column_comments_truncated` 
CHANGE COLUMN `col1` `col1` INT(11) NOT NULL COMMENT '10/6/2017 11:54AM:\nNeed to self-join table.\nCombining multiple qortbl2 words to match up with one quran.word word:\n---------------t1-----------------------		------------------t2------------------\nSVWunion	wordPhonetic		qortbl2_wordSVW	qortbl2word\n109:1:1		qul			109:1:1	 	qul\n109:1:2	 	yāayyuhā		109:1:2	 	yaa\n109:1:3	 	l-kāfirūna			109:1:2	 	\'ayy-u-haa\n109:1:4	 				109:1:3	 	l-kaafir-uuna\n\nSELECT \n   t1.SVWunion,\n   t1.wordPhonetic,\nGROUP_CONCAT(t2.qortbl2word SEPARATOR \'\\n\') AS UofHaifaTranscription\nFROM\n   quran.svw_union_word_qortbl2 AS t1\nRIGHT JOIN  -- ignores row 109:1:4 in t1\n   quran.svw_union_word_qortbl2 AS t2\nON\n   t1.SVWunion = t2.qortbl2_wordSVW\nWHERE\n   t2.qortbl2_wordSVW IS NOT NULL\nGROUP BY\n   t2.qortbl2_wordSVW\nORDER BY\n   t1.ID;\n\nListing one qortbl2 word multiple times i.e. multiple quran.word words are combined to form one qortbl2 word:\n--------------------------------t1----------------------------------			--------------t2----------------------\nSVWunion	wordPhonetic	word_qortbl2SVW			SVW' ;

========================================================================
---SCENARIO 5---
========================================================================

Add 'X' at the end (i.e. now 1025 characters):

Seems it incorrectly truncates to 386 characters per Script created by Workbench:

ALTER TABLE `test`.`test_column_comments_truncated` 
CHANGE COLUMN `col1` `col1` INT(11) NOT NULL COMMENT '10/6/2017 11:54AM:\nNeed to self-join table.\nCombining multiple qortbl2 words to match up with one quran.word word:\n---------------t1-----------------------		------------------t2------------------\nSVWunion	wordPhonetic		qortbl2_wordSVW	qortbl2word\n109:1:1		qul			109:1:1	 	qul\n109:1:2	 	yāayyuhā		109:1:2	 	yaa\n109:1:3	 	l-kāfirūna			109:1:2	 	\'ayy-u-haa\n109:1:4	 				109:1:3	 	l-kaafir-' /* comment truncated */ /*una

SELECT 
   t1.SVWunion,
   t1.wordPhonetic,
GROUP_CONCAT(t2.qortbl2word SEPARATOR '\n') AS UofHaifaTranscription
FROM
   quran.svw_union_word_qortbl2 AS t1
RIGHT JOIN  -- ignores row 109:1:4 in t1
   quran.svw_union_word_qortbl2 AS t2
ON
   t1.SVWunion = t2.qortbl2_wordSVW
WHERE
   t2.qortbl2_wordSVW IS NOT NULL
GROUP BY
   t2.qortbl2_wordSVW
ORDER BY
   t1.ID;

Listing one qortbl2 word multiple times i.e. multiple quran.word words are combined to form one qortbl2 word:
--------------------------------t1----------------------------------			--------------t2----------------------
SVWunion	wordPhonetic	word_qortbl2SVW			SVWX*/ ;

Seems it does not report on the first "u" that was truncated (there were 2: "uuna\n\n")

Suggested fix:
Code needs to be debugged
[9 Oct 2017 8:03] Umesh Shastry
Hello Sam Abboushi,

Thank you for the report and test case.

Thanks,
Umesh