MySQL Insert Incorrect CRC32 hash -
i have mysql table products, has url , url_crc fields. have incorrect crc32 calculating @ time of insert.
insert products (url, url_crc) values ('http://www.zappos.com/product/7859366/color/106', crc32('http://www.zappos.com/product/7859366/color/106'))
result is: http://www.zappos.com/product/7859366/color/106, 2147483647
but when this:
select crc32('http://www.zappos.com/product/7859366/color/106')
result is: 2838206275
why happen ? 2838206275 != 2147483647
.
triggers didn't help. result same.
the maximum value of 32 bit signed integer 2^31-1.
2838206275 greater that.
(2147483647 conveniently 2^31-1).
in other words, use larger data type (bigint).
Comments
Post a Comment