Skip to content

Fixed conv function max_ length bug #380

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

Closed
wants to merge 1 commit into from

Conversation

chen-chukun
Copy link

The max_length of the conv function is 64 bytes. In a multi-byte characters, the result may be truncated.

For example:

set names utf8mb4;
drop table if exists test;
create table test(id varchar(10));
insert into test values('abcdef');

correct result:

mysql> select conv(id, 16, 2) id from test;
+--------------------------+
| id |
+--------------------------+
| 101010111100110111101111 |
+--------------------------+
1 row in set (0.00 sec)

truncated:

mysql> select conv(id, 16, 2) id from test group by id;
+------------------+
| id |
+------------------+
| 1010101111001101 |
+------------------+
1 row in set, 1 warning (0.00 sec)

mysql> create table tmp select conv(id, 16, 2) id from test;
ERROR 1406 (22001): Data too long for column 'id' at row 1

@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 https://oca.opensource.oracle.com/
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

@chen-chukun
Copy link
Author

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=105598 for updates.
Thanks

@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=105598 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
Development

Successfully merging this pull request may close these issues.

2 participants