I have MySQL table products, which has url and url_crc fields. I have incorrect CRC32 calculating at the time of insert.
INSERT INTO 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 i do this:
SELECT CRC32(‘http://www.zappos.com/product/7859366/color/106’)
Result is: 2838206275
Why is this happen ? 2838206275 != 2147483647.
Triggers didn’t help. Result is the same.
The maximum value of a 32 bit signed integer is 2^31-1.
2838206275 is greater than that.
(2147483647 is conveniently 2^31-1).
In other words, use a larger data type (bigint).