Change your datatype of the column into INT UNSIGNED
. The reason for that is you are using SIGNED INT
that's why the maximum value is only 2147483647
.
CREATE TABLE tableNAME
(
full_url_hash INT UNSIGNED
-- other columns
)
Pregunta
I am having a bizarre issue with two queries returning different hash values for CRC32 with the same string.
If I run:
SELECT 'http://mywebsite4.com/myvideos', CRC32('http://mywebsite4.com/myvideos');
The hash values returned are 3769016377.
If I then run
INSERT INTO locations (full_url, full_url_hash) VALUES ('http://mywebsite4.com/myvideos', CRC32('http://mywebsite4.com/myvideos'))
The hash values inserted are 2147483647.
Is there something obvious that I'm missing here? As far as I understand the CRC32 function should always hash equal strings to equal 32 bit integers, I can't for the life of me figure out why they're different in this case.
Thanks!
Solución
Change your datatype of the column into INT UNSIGNED
. The reason for that is you are using SIGNED INT
that's why the maximum value is only 2147483647
.
CREATE TABLE tableNAME
(
full_url_hash INT UNSIGNED
-- other columns
)