Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calculating columns sizes based on the character set in mysql client #267

Closed
wants to merge 1 commit into from

Conversation

yurriy
Copy link

@yurriy yurriy commented May 26, 2019

Currently, print_table_data calculates the size of the column as a length of its longest value in bytes (or of its name, if it is longer).
This results in output with additional spaces for multibyte strings. (for utf8, a column can be 2-4 times larger than its longest value).
In this patch column size is calculated based on the character set which client uses.

How to reproduce:
select 'ⲫ' as x;
Output:

+-----+
| x   |
+-----+
| ⲫ   |
+-----+

Expected output:

+---+
| x |
+---+
| ⲫ |
+---+

@mysql-oca-bot
Copy link

Hi, thank you for submitting this pull request. In order to consider your code we need you to sign the Oracle Contribution Agreement (OCA). Please review the details and follow the instructions at http://www.oracle.com/technetwork/community/oca-486395.html
Please make sure to include your MySQL bug system user (email) in the returned form.
Thanks

@mysql-oca-bot
Copy link

Hi, thank you for your contribution. Please confirm this code is submitted under the terms of the OCA (Oracle's Contribution Agreement) you have previously signed by cutting and pasting the following text as a comment:
"I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it."
Thanks

@yurriy
Copy link
Author

yurriy commented May 27, 2019

I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

@mysql-oca-bot
Copy link

Hi, thank you for your contribution. Your code has been assigned to an internal queue. Please follow
bug http://bugs.mysql.com/bug.php?id=95550 for updates.
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants