MySql UUID重复BUG [英] MySql UUID duplication BUG
问题描述
执行时:
select uuid(),uuid();
你得到两个等号ids。
当我将两个uuids插入到我的表中时,我遇到两个这个错误,我总是有相同的值。
有没有人跑过这个bug?如何执行需要两个uuid的插入命令?
修改:
其实我错了,他们在一个数字上有所不同,所以很难看到
c3db913 7 -705e-11e1-ae17-1c6f6531b785
c3db913 f -705e-11e1-ae17-1c6f6531b785
从文档 UUID被设计为在空间和时间上是全球唯一的数字。由于查询在执行之前被编译,所以您正在调用 UUID()
在同一时刻两次。因此,您不能指望它在同一查询中返回两个唯一值,因为这两个值都将使用相同的时间戳。这听起来像我想要的行为。
There is a bug that I found in MySql 5.5.19.
When executing:
select uuid(), uuid();
You are getting two equals ids.
I run in two this bug when inserted two uuids to my table, I always got same values.
Does anyone else run in two this bug? How can I perform insert command that requires two uuids for my keys?
Edit:
Actually I got wrong they are different in one digit so it was really hard to see
c3db9137-705e-11e1-ae17-1c6f6531b785
c3db913f-705e-11e1-ae17-1c6f6531b785
From the docs A UUID is designed as a number that is globally unique in space and time. Since the query is compiled before being executed, you are calling UUID()
twice at the same moment in time. Therefore, you cannot expect it to return two unique values in the same query since the same timestamp would be used for both values. This sounds like intended behavior to me.
这篇关于MySql UUID重复BUG的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!