Welcome Guest, Not a member yet? Register   Sign In
"Duplicate entry ... " error on valid SQL
#11

[eluser]drewbee[/eluser]
ahahe. Can I assume this was the case of auto incremement reaching tinyint's maximum length?
#12

[eluser]gvillavizar[/eluser]
[quote author="drewbee" date="1236639158"]ahahe. Can I assume this was the case of auto incremement reaching tinyint's maximum length?[/quote]

Effectively. In my case the entry 127 was always repeating for the key value. A little research says that the minimun value of tinyint is -128 and the maximun value is 127.

I wasn't aware of this limit before, so I think I will study a little more the data types before I use them in my databases.

If somebody wants more references on this matter, check the MySQL Reference Manual.
#13

[eluser]drewbee[/eluser]
Yup. I have reserved tinyint's strictly for set choices IE 1,2,3,4,5 or for true or false (with 0 and 1); anything that is close to resembling an ID should be taken to atleast smallint.

I wonder if their is a script out their anywhere that checks column types and can compare it against its current value, and send out a nice little notification when it gets near a specified amount to reaching its max.

That would be cool.

I wonder what happens when you reach 18446744073709551615 (BIGINT);

I assume if that is an actual number... some company is doing really well!
#14

[eluser]jedd[/eluser]
Ahh, this is what happens when you don't have a basic understanding of types. Or bytes, bits, words, nybbles, and so on. Though I thought auto increment wasn't allowed to be signed in MySQL - perhaps I remember that wrongly.

I was consistently using SERIAL as a shorthand for all my id / PK fields, and then got a bit concerned when I discovered that PHP(5) has no native way of dealing with numbers this big. I gather v6 will include MIGHTYLARGEINT or something similar (actually a 64bit INT I guess) which will correlate with MySQL's largest INT options. (I still use SERIAL, I just sigh wistfully every time I do.)

Not that I'm about to hit such limits .. just nice to be able to design it now, knowing you'll never have to worry about sync issues with data types later. Ever.




Theme © iAndrew 2016 - Forum software by © MyBB