strange mysql table naming problem

Chilly

Balls of steel
Joined
Dec 22, 2003
Messages
9,047
why is

8484e64391d10b14d7938b1f7b37a4a1

an invalid table name?

335e9425552a4dcb762b4bc424ba0902

is also invalid.

According to mysql, a table name must be shorter than 64bytes long and can contain any characters that are legal in a unix filename excluding / \ . and ASCII 0 and ASCII 255.

Neither of these names seem to break this rule. Have I found a bug or am I missing something trivial?

I have experimented and found that appending the table name with an arbitrary letter, a, prevents the table name from being illegal. Likewise, appending "3" to the name seems to increase the chance the random table name generated will be illegal. I have collected a few table names that appear to be illegal and they all start with numbers

For reference, this problem cropped up when using temporary tables, and naming these tables with a (nearly) unique name generated from a random number that gets md5'd. Because the name is occasionally illegal the table did not get created and a load or errors cropped up because the program could not find the table to query.

Cheers,

Chilly
 

Chilly

Balls of steel
Joined
Dec 22, 2003
Messages
9,047
Having rtfm (well, having Athan do it for me), the problem was with the character "e". When you write 4e4 mysql thinks its an exponent and goes a bit loopy. MD5 is not reccomended for generating table names :)
 

SheepCow

Bringer of Code
Joined
Dec 22, 2003
Messages
1,365
mm interesting. There are some other reserved words you cannot use as table names.
 

Chilly

Balls of steel
Joined
Dec 22, 2003
Messages
9,047
It's not reserved as such. It's more that the engine thinks your trying to use expoenent notation and gets in a muddle.
 

SheepCow

Bringer of Code
Joined
Dec 22, 2003
Messages
1,365
Yes yes, I wasn't saying it was a reserved word -- more that there are reserved words to look out for also. :)
 

Users who are viewing this thread

Top Bottom