Gossamer Forum
Home : General : Databases and SQL :

I'm mad :(

Quote Reply
I'm mad :(
I created a table in MySQL called "Log" - built a script around it but now my installer script always barfs with a syntax error when it tries to create that table. Hmm so I went to the MySQL reserved word list and "Log" isn't listed :(

When I change it to "Logs" the error goes.

That really sucks.

Last edited by:

Paul: Jan 12, 2003, 1:47 PM
Quote Reply
Re: [Paul] I'm mad :( In reply to
Could be column names in that table that is causing problems.
========================================
Buh Bye!

Cheers,
Me
Quote Reply
Re: [Stealth] I'm mad :( In reply to
As I said, when I rename the table from Log to Logs then it is created without a problem. All the columns are log_ prefixed so they won't be reserved, eg....

log_id
log_user_id_fk

Thanks though.
Quote Reply
Re: [Paul] I'm mad :( In reply to
What's the query and the error?

Quote:
mysql> create table Log (a int);
Query OK, 0 rows affected (0.00 sec)

mysql> select version();
+-----------+
| version() |
+-----------+
| 3.23.54 |
+-----------+
1 row in set (0.00 sec)

mysql>

works here.

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] I'm mad :( In reply to
The query is:

Code:
CREATE TABLE Log(
log_camp_id_fk int(10) NOT NULL DEFAULT '0' ,
log_med_id_fk int(10) NOT NULL DEFAULT '0' ,
log_timestamp int(15) NOT NULL DEFAULT '0' ,
log_ip varchar(15) NOT NULL DEFAULT '' ,
log_type enum('1','2') NOT NULL DEFAULT '2'
)

...and the error is:

Reason: You have an error in your SQL syntax near 'Log( log_camp_id_fk int(10) NOT NULL DEFAULT '0' , log_med_id_fk int(10) NOT' at line 11064.

I just tried it again now incase it was a freaky error and it happened again. Using "Logs" worked fine :(

Quote:
Executed Query: CREATE TABLE Logs( log_camp_id_fk int(10) NOT NULL DEFAULT '0' , log_med_id_fk int(10) NOT NULL DEFAULT '0' , log_timestamp int(15) NOT NULL DEFAULT '0' , log_ip varchar(15) NOT NULL DEFAULT '' , log_type enum('1','2') NOT NULL DEFAULT '2' )

Last edited by:

Paul: Jan 14, 2003, 10:10 AM
Quote Reply
Re: [Alex] I'm mad :( In reply to
Ok thats weird. When I add a space between g and ( the query works. Why don't I have to do that with Logs?
Quote Reply
Re: [Paul] I'm mad :( In reply to
That's because you are meant to have a space after the table name. =)

http://www.mysql.com/...en/CREATE_TABLE.html

Quote:
mysql> CREATE TABLE Log (
-> log_camp_id_fk int(10) NOT NULL DEFAULT '0' ,
-> log_med_id_fk int(10) NOT NULL DEFAULT '0' ,
-> log_timestamp int(15) NOT NULL DEFAULT '0' ,
-> log_ip varchar(15) NOT NULL DEFAULT '' ,
-> log_type enum('1','2') NOT NULL DEFAULT '2'
-> );
Query OK, 0 rows affected (0.00 sec)

mysql>

Seems to trip up mysql otherwise. Strange.

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] I'm mad :( In reply to
Blech. They could at least have made Logs fail too, to give me some sort of hint ;) ...here's me thinking it the word "Log" ...bah.