>>>>> "Martin" == Martin Ramsch <m.ramsch@stripped> writes:
Martin> On Tue, 1999-10-12 06:22:07 -0400, Bob Kline wrote:
>> On Tue, 12 Oct 1999, Martin Ramsch wrote:
>>
>> > On Tue, 1999-10-12 14:53:13 +0800, Jon Hui wrote:
>> > > On page 102 of the mysql manual it states that a database name can
>> > > start with a number. When I tried to name a database '3direct', it
>> > > gave me the message 'incorrect database name '3direct''. How come?
>> >
>> > You mean chapter "7.1.5 Database, table, index, column and alias
>> > names" of the MySQL Reference Manual?
>> >
>> > The manual seems to be wrong here for database names!
>> >
>>
>> You must be running a very old version of the software, too, Martin.
Martin> No, not that old ;)
Martin> My version is 3.22.19b!
>> This is from the change logs for 3.20.0:
>>
>> Changed parser to allow a database, table or field name to start
>> with a number or '_'.
Martin> Either this has changed again later on, or this entry was just wrong
Martin> and never did apply to database names.
Martin> Maybe Monty can shed some light on this issue?
Hi!
From the ultimate documentation:
bool check_name(const char *db)
{
...
if (!isalpha(*db) && *db != '_' && *db != '$')
return 1; // Can't start with num
for (db++ ; *db ; db++)
{
if (!isvar(*db) && *db != '$')
return 1;
}
return 0;
...
}
Which means that the database can't currently start with a number. (I
actually don't remember why I added this restriction; It may have been
some problem with the parsing). Anyway; It's not a good idea
to have a database, table or column start with a number as this make
the name incompatible with other SQL servers and also makes the
parsing a bit slower..
Regards,
Monty