Skip to content

inconsistent result for built in function uuid_to_bin #30325

@unconsolable

Description

@unconsolable

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 ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions