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

inconsistent result for built in function uuid_to_bin #30325

Closed
unconsolable opened this issue Dec 1, 2021 · 1 comment
Closed

inconsistent result for built in function uuid_to_bin #30325

unconsolable opened this issue Dec 1, 2021 · 1 comment
Labels

Comments

@unconsolable
Copy link
Contributor

Bug Report

Please answer these questions before submitting your issue. Thanks!

Ref #30318 (comment)
Ref #30318 (comment)

1. Minimal reproduce step (Required)

select uuid_to_bin('urn:uuid:99a9ad03-5298-11ec-8f5c-00ff90147ac3');
select uuid_to_bin(' 99a9ad03-5298-11ec-8f5c-00ff90147ac3 ');

2. What did you expect to see? (Required)

MySQL 8.0.27

mysql> select uuid_to_bin('urn:uuid:99a9ad03-5298-11ec-8f5c-00ff90147ac3');
ERROR 1411 (HY000): Incorrect string value: 'urn:uuid:99a9ad03-5298-11ec-8f5c-00ff90147ac3' for function uuid_to_bin
mysql> select uuid_to_bin(' 99a9ad03-5298-11ec-8f5c-00ff90147ac3 ');
ERROR 1411 (HY000): Incorrect string value: ' 99a9ad03-5298-11ec-8f5c-00ff90147ac3 ' for function uuid_to_bin

3. What did you see instead (Required)

mysql> select uuid_to_bin('urn:uuid:99a9ad03-5298-11ec-8f5c-00ff90147ac3');
0x99A9AD03529811EC8F5C00FF90147AC3

mysql> select uuid_to_bin(' 99a9ad03-5298-11ec-8f5c-00ff90147ac3 ');
0x99A9AD03529811EC8F5C00FF90147AC3

4. What is your TiDB version? (Required)

Release Version: v5.3.0
Edition: Community
Git Commit Hash: 4a1b2e9
Git Branch: heads/refs/tags/v5.3.0
UTC Build Time: 2021-11-24 13:32:39
GoVersion: go1.16.4
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false


Seems it is related to upstream package github.com/google/uuid and it's way of Parse, there are tracking issues google/uuid#60 and google/uuid#61, but haven't been merged after a year.
Not sure whether this incompatibility should be kept. And if we fix it, are there better ways than just adding a wrapper ?

@unconsolable unconsolable added the type/bug This issue is a bug. label Dec 1, 2021
@aytrack aytrack added type/question sig/execution SIG execution and removed type/bug This issue is a bug. labels Dec 2, 2021
@unconsolable
Copy link
Contributor Author

In TestUUID some test cases are added as follows:

// This is a bug in google/uuid#60
{"{99a9ad03-5298-11ec-8f5c-00ff90147ac3*", 1},
// This is a format google/uuid support, while mysql doesn't
{"urn:uuid:99a9ad03-5298-11ec-8f5c-00ff90147ac3", 1},

If the behaviour changes, the test will be broken, so IMHO this issue can be closed now.

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

No branches or pull requests

2 participants