{"action":"created","comment":{"url":"https://api.github.com/repos/pingcap/tidb/pulls/comments/282338414","pull_request_review_id":235399061,"id":282338414,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI4MjMzODQxNA==","diff_hunk":"@@ -798,6 +798,9 @@ func (d *Datum) convertToString(sc *stmtctx.StatementContext, target *FieldType)\n \t\ts = strconv.FormatFloat(d.GetFloat64(), 'f', -1, 64)\n \tcase KindString, KindBytes:\n \t\ts = d.GetString()\n+\t\tif target.Tp == mysql.TypeString {\n+\t\t\ts=strings.TrimRight(s, \" \")","path":"types/datum.go","position":5,"original_position":5,"commit_id":"d5425e1b4114acec6d16584edcfa45ebfba0fca7","original_commit_id":"d5425e1b4114acec6d16584edcfa45ebfba0fca7","user":{"login":"lonng","id":1638682,"node_id":"MDQ6VXNlcjE2Mzg2ODI=","avatar_url":"https://avatars3.githubusercontent.com/u/1638682?v=4","gravatar_id":"","url":"https://api.github.com/users/lonng","html_url":"https://github.com/lonng","followers_url":"https://api.github.com/users/lonng/followers","following_url":"https://api.github.com/users/lonng/following{/other_user}","gists_url":"https://api.github.com/users/lonng/gists{/gist_id}","starred_url":"https://api.github.com/users/lonng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lonng/subscriptions","organizations_url":"https://api.github.com/users/lonng/orgs","repos_url":"https://api.github.com/users/lonng/repos","events_url":"https://api.github.com/users/lonng/events{/privacy}","received_events_url":"https://api.github.com/users/lonng/received_events","type":"User","site_admin":false},"body":"I am sure `TrimRight` is not the correct behavior.\r\n```\r\nmysql> insert into vctt values (\"ab  \", \"  ab   \");\r\nmysql> select concat('(', v, ')'), concat('(', c, ')') from vctt;\r\n+-------------------------------------------+\r\n| concat('(', v, ')') | concat('(', c, ')') |\r\n+-------------------------------------------+\r\n| (ab  )              | (ab)                |\r\n+-------------------------------------------+\r\n3 row in set (0.002 sec)\r\n```","created_at":"2019-05-09T04:57:42Z","updated_at":"2019-05-09T04:57:43Z","html_url":"https://github.com/pingcap/tidb/pull/10402#discussion_r282338414","pull_request_url":"https://api.github.com/repos/pingcap/tidb/pulls/10402","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/pingcap/tidb/pulls/comments/282338414"},"html":{"href":"https://github.com/pingcap/tidb/pull/10402#discussion_r282338414"},"pull_request":{"href":"https://api.github.com/repos/pingcap/tidb/pulls/10402"}}},"pull_request":{"url":"https://api.github.com/repos/pingcap/tidb/pulls/10402","id":277244084,"node_id":"MDExOlB1bGxSZXF1ZXN0Mjc3MjQ0MDg0","html_url":"https://github.com/pingcap/tidb/pull/10402","diff_url":"https://github.com/pingcap/tidb/pull/10402.diff","patch_url":"https://github.com/pingcap/tidb/pull/10402.patch","issue_url":"https://api.github.com/repos/pingcap/tidb/issues/10402","number":10402,"state":"open","locked":false,"title":"#10392 fix char column not compatibile with mysql","user":{"login":"zhuozl","id":16550094,"node_id":"MDQ6VXNlcjE2NTUwMDk0","avatar_url":"https://avatars3.githubusercontent.com/u/16550094?v=4","gravatar_id":"","url":"https://api.github.com/users/zhuozl","html_url":"https://github.com/zhuozl","followers_url":"https://api.github.com/users/zhuozl/followers","following_url":"https://api.github.com/users/zhuozl/following{/other_user}","gists_url":"https://api.github.com/users/zhuozl/gists{/gist_id}","starred_url":"https://api.github.com/users/zhuozl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zhuozl/subscriptions","organizations_url":"https://api.github.com/users/zhuozl/orgs","repos_url":"https://api.github.com/users/zhuozl/repos","events_url":"https://api.github.com/users/zhuozl/events{/privacy}","received_events_url":"https://api.github.com/users/zhuozl/received_events","type":"User","site_admin":false},"body":"<!--\r\nThank you for contributing to TiDB! Please read TiDB's [CONTRIBUTING](https://github.com/pingcap/tidb/blob/master/CONTRIBUTING.md) document **BEFORE** filing this PR.\r\n-->\r\n\r\n### What problem does this PR solve? <!--add issue link with summary if exists-->\r\n\r\nfor #10392 \r\n\r\n### What is changed and how it works?\r\n\r\nadd condition in  types/datum.go\r\n\r\n\r\n### Check List <!--REMOVE the items that are not applicable-->\r\n\r\nTests <!-- At least one of them must be included. -->\r\n\r\n - Integration test\r\n - Manual test (add detailed scripts or steps below)\r\n\r\n```\r\ncreate table vctt (v varchar(4), c char(4))\r\nmysql> insert into vctt values (\"ab  \", \"  ab   \");\r\nQuery OK, 1 row affected (0.04 sec)\r\nmysql> select * from vctt;\r\n+------+------+\r\n| v    | c    |\r\n+------+------+\r\n| ab   | NULL |\r\n| ab   | NULL |\r\n| NULL | ab   |\r\n| NULL | ab   |\r\n| ab   | ab   |\r\n| ab   |   ab |\r\n| ab   |   ab |\r\n| ab   | ab   |\r\n+------+------+\r\n8 rows in set (0.00 sec)\r\n\r\n```\r\n\r\nCode changes\r\n\r\n - Has exported function/method change\r\n - Has exported variable/fields change\r\n - Has interface methods change\r\n - Has persistent data change\r\n\r\nSide effects\r\n\r\n - Possible performance regression\r\n - Increased code complexity\r\n - Breaking backward compatibility\r\n\r\nRelated changes\r\n\r\n - Need to cherry-pick to the release branch\r\n - Need to update the documentation\r\n - Need to update the `tidb-ansible` repository\r\n - Need to be included in the release note\r\n","created_at":"2019-05-09T04:43:15Z","updated_at":"2019-05-09T04:57:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e4db87128e688d6e993f8653f7de7a3b8be2e5a2","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/pingcap/tidb/pulls/10402/commits","review_comments_url":"https://api.github.com/repos/pingcap/tidb/pulls/10402/comments","review_comment_url":"https://api.github.com/repos/pingcap/tidb/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pingcap/tidb/issues/10402/comments","statuses_url":"https://api.github.com/repos/pingcap/tidb/statuses/d5425e1b4114acec6d16584edcfa45ebfba0fca7","head":{"label":"zhuozl:fix-char-column-compatible","ref":"fix-char-column-compatible","sha":"d5425e1b4114acec6d16584edcfa45ebfba0fca7","user":{"login":"zhuozl","id":16550094,"node_id":"MDQ6VXNlcjE2NTUwMDk0","avatar_url":"https://avatars3.githubusercontent.com/u/16550094?v=4","gravatar_id":"","url":"https://api.github.com/users/zhuozl","html_url":"https://github.com/zhuozl","followers_url":"https://api.github.com/users/zhuozl/followers","following_url":"https://api.github.com/users/zhuozl/following{/other_user}","gists_url":"https://api.github.com/users/zhuozl/gists{/gist_id}","starred_url":"https://api.github.com/users/zhuozl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zhuozl/subscriptions","organizations_url":"https://api.github.com/users/zhuozl/orgs","repos_url":"https://api.github.com/users/zhuozl/repos","events_url":"https://api.github.com/users/zhuozl/events{/privacy}","received_events_url":"https://api.github.com/users/zhuozl/received_events","type":"User","site_admin":false},"repo":{"id":185115841,"node_id":"MDEwOlJlcG9zaXRvcnkxODUxMTU4NDE=","name":"tidb","full_name":"zhuozl/tidb","private":false,"owner":{"login":"zhuozl","id":16550094,"node_id":"MDQ6VXNlcjE2NTUwMDk0","avatar_url":"https://avatars3.githubusercontent.com/u/16550094?v=4","gravatar_id":"","url":"https://api.github.com/users/zhuozl","html_url":"https://github.com/zhuozl","followers_url":"https://api.github.com/users/zhuozl/followers","following_url":"https://api.github.com/users/zhuozl/following{/other_user}","gists_url":"https://api.github.com/users/zhuozl/gists{/gist_id}","starred_url":"https://api.github.com/users/zhuozl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zhuozl/subscriptions","organizations_url":"https://api.github.com/users/zhuozl/orgs","repos_url":"https://api.github.com/users/zhuozl/repos","events_url":"https://api.github.com/users/zhuozl/events{/privacy}","received_events_url":"https://api.github.com/users/zhuozl/received_events","type":"User","site_admin":false},"html_url":"https://github.com/zhuozl/tidb","description":"TiDB is a distributed HTAP database compatible with the MySQL protocol ","fork":true,"url":"https://api.github.com/repos/zhuozl/tidb","forks_url":"https://api.github.com/repos/zhuozl/tidb/forks","keys_url":"https://api.github.com/repos/zhuozl/tidb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zhuozl/tidb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zhuozl/tidb/teams","hooks_url":"https://api.github.com/repos/zhuozl/tidb/hooks","issue_events_url":"https://api.github.com/repos/zhuozl/tidb/issues/events{/number}","events_url":"https://api.github.com/repos/zhuozl/tidb/events","assignees_url":"https://api.github.com/repos/zhuozl/tidb/assignees{/user}","branches_url":"https://api.github.com/repos/zhuozl/tidb/branches{/branch}","tags_url":"https://api.github.com/repos/zhuozl/tidb/tags","blobs_url":"https://api.github.com/repos/zhuozl/tidb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zhuozl/tidb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zhuozl/tidb/git/refs{/sha}","trees_url":"https://api.github.com/repos/zhuozl/tidb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zhuozl/tidb/statuses/{sha}","languages_url":"https://api.github.com/repos/zhuozl/tidb/languages","stargazers_url":"https://api.github.com/repos/zhuozl/tidb/stargazers","contributors_url":"https://api.github.com/repos/zhuozl/tidb/contributors","subscribers_url":"https://api.github.com/repos/zhuozl/tidb/subscribers","subscription_url":"https://api.github.com/repos/zhuozl/tidb/subscription","commits_url":"https://api.github.com/repos/zhuozl/tidb/commits{/sha}","git_commits_url":"https://api.github.com/repos/zhuozl/tidb/git/commits{/sha}","comments_url":"https://api.github.com/repos/zhuozl/tidb/comments{/number}","issue_comment_url":"https://api.github.com/repos/zhuozl/tidb/issues/comments{/number}","contents_url":"https://api.github.com/repos/zhuozl/tidb/contents/{+path}","compare_url":"https://api.github.com/repos/zhuozl/tidb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zhuozl/tidb/merges","archive_url":"https://api.github.com/repos/zhuozl/tidb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zhuozl/tidb/downloads","issues_url":"https://api.github.com/repos/zhuozl/tidb/issues{/number}","pulls_url":"https://api.github.com/repos/zhuozl/tidb/pulls{/number}","milestones_url":"https://api.github.com/repos/zhuozl/tidb/milestones{/number}","notifications_url":"https://api.github.com/repos/zhuozl/tidb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zhuozl/tidb/labels{/name}","releases_url":"https://api.github.com/repos/zhuozl/tidb/releases{/id}","deployments_url":"https://api.github.com/repos/zhuozl/tidb/deployments","created_at":"2019-05-06T03:15:22Z","updated_at":"2019-05-06T03:15:28Z","pushed_at":"2019-05-09T04:40:59Z","git_url":"git://github.com/zhuozl/tidb.git","ssh_url":"git@github.com:zhuozl/tidb.git","clone_url":"https://github.com/zhuozl/tidb.git","svn_url":"https://github.com/zhuozl/tidb","homepage":"https://pingcap.com","size":131461,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"pingcap:master","ref":"master","sha":"37e824134f46051012fb72ce07389e4f6bef8478","user":{"login":"pingcap","id":11855343,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExODU1MzQz","avatar_url":"https://avatars3.githubusercontent.com/u/11855343?v=4","gravatar_id":"","url":"https://api.github.com/users/pingcap","html_url":"https://github.com/pingcap","followers_url":"https://api.github.com/users/pingcap/followers","following_url":"https://api.github.com/users/pingcap/following{/other_user}","gists_url":"https://api.github.com/users/pingcap/gists{/gist_id}","starred_url":"https://api.github.com/users/pingcap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pingcap/subscriptions","organizations_url":"https://api.github.com/users/pingcap/orgs","repos_url":"https://api.github.com/users/pingcap/repos","events_url":"https://api.github.com/users/pingcap/events{/privacy}","received_events_url":"https://api.github.com/users/pingcap/received_events","type":"Organization","site_admin":false},"repo":{"id":41986369,"node_id":"MDEwOlJlcG9zaXRvcnk0MTk4NjM2OQ==","name":"tidb","full_name":"pingcap/tidb","private":false,"owner":{"login":"pingcap","id":11855343,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExODU1MzQz","avatar_url":"https://avatars3.githubusercontent.com/u/11855343?v=4","gravatar_id":"","url":"https://api.github.com/users/pingcap","html_url":"https://github.com/pingcap","followers_url":"https://api.github.com/users/pingcap/followers","following_url":"https://api.github.com/users/pingcap/following{/other_user}","gists_url":"https://api.github.com/users/pingcap/gists{/gist_id}","starred_url":"https://api.github.com/users/pingcap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pingcap/subscriptions","organizations_url":"https://api.github.com/users/pingcap/orgs","repos_url":"https://api.github.com/users/pingcap/repos","events_url":"https://api.github.com/users/pingcap/events{/privacy}","received_events_url":"https://api.github.com/users/pingcap/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/pingcap/tidb","description":"TiDB is a distributed HTAP database compatible with the MySQL protocol ","fork":false,"url":"https://api.github.com/repos/pingcap/tidb","forks_url":"https://api.github.com/repos/pingcap/tidb/forks","keys_url":"https://api.github.com/repos/pingcap/tidb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pingcap/tidb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pingcap/tidb/teams","hooks_url":"https://api.github.com/repos/pingcap/tidb/hooks","issue_events_url":"https://api.github.com/repos/pingcap/tidb/issues/events{/number}","events_url":"https://api.github.com/repos/pingcap/tidb/events","assignees_url":"https://api.github.com/repos/pingcap/tidb/assignees{/user}","branches_url":"https://api.github.com/repos/pingcap/tidb/branches{/branch}","tags_url":"https://api.github.com/repos/pingcap/tidb/tags","blobs_url":"https://api.github.com/repos/pingcap/tidb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pingcap/tidb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pingcap/tidb/git/refs{/sha}","trees_url":"https://api.github.com/repos/pingcap/tidb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pingcap/tidb/statuses/{sha}","languages_url":"https://api.github.com/repos/pingcap/tidb/languages","stargazers_url":"https://api.github.com/repos/pingcap/tidb/stargazers","contributors_url":"https://api.github.com/repos/pingcap/tidb/contributors","subscribers_url":"https://api.github.com/repos/pingcap/tidb/subscribers","subscription_url":"https://api.github.com/repos/pingcap/tidb/subscription","commits_url":"https://api.github.com/repos/pingcap/tidb/commits{/sha}","git_commits_url":"https://api.github.com/repos/pingcap/tidb/git/commits{/sha}","comments_url":"https://api.github.com/repos/pingcap/tidb/comments{/number}","issue_comment_url":"https://api.github.com/repos/pingcap/tidb/issues/comments{/number}","contents_url":"https://api.github.com/repos/pingcap/tidb/contents/{+path}","compare_url":"https://api.github.com/repos/pingcap/tidb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pingcap/tidb/merges","archive_url":"https://api.github.com/repos/pingcap/tidb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pingcap/tidb/downloads","issues_url":"https://api.github.com/repos/pingcap/tidb/issues{/number}","pulls_url":"https://api.github.com/repos/pingcap/tidb/pulls{/number}","milestones_url":"https://api.github.com/repos/pingcap/tidb/milestones{/number}","notifications_url":"https://api.github.com/repos/pingcap/tidb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pingcap/tidb/labels{/name}","releases_url":"https://api.github.com/repos/pingcap/tidb/releases{/id}","deployments_url":"https://api.github.com/repos/pingcap/tidb/deployments","created_at":"2015-09-06T04:01:52Z","updated_at":"2019-05-09T03:43:19Z","pushed_at":"2019-05-09T04:53:17Z","git_url":"git://github.com/pingcap/tidb.git","ssh_url":"git@github.com:pingcap/tidb.git","clone_url":"https://github.com/pingcap/tidb.git","svn_url":"https://github.com/pingcap/tidb","homepage":"https://pingcap.com","size":131725,"stargazers_count":18528,"watchers_count":18528,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2679,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":847,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":2679,"open_issues":847,"watchers":18528,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pingcap/tidb/pulls/10402"},"html":{"href":"https://github.com/pingcap/tidb/pull/10402"},"issue":{"href":"https://api.github.com/repos/pingcap/tidb/issues/10402"},"comments":{"href":"https://api.github.com/repos/pingcap/tidb/issues/10402/comments"},"review_comments":{"href":"https://api.github.com/repos/pingcap/tidb/pulls/10402/comments"},"review_comment":{"href":"https://api.github.com/repos/pingcap/tidb/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pingcap/tidb/pulls/10402/commits"},"statuses":{"href":"https://api.github.com/repos/pingcap/tidb/statuses/d5425e1b4114acec6d16584edcfa45ebfba0fca7"}},"author_association":"NONE"}}
{"actor":{"display_login":"lonng"}}