Error when table name is 'date'

5 posts / 0 new
Last post
arekanderu
arekanderu's picture
Offline
Last seen: 3 years 3 weeks ago
Joined: May 17 2010
Senior Boarder

Posts: 31

arekanderu arekanderu
Error when table name is 'date'

Hello,

I am trying to execute the following query:

[code]
CREATE TABLE IF NOT EXISTS `date` (
`date_id` int(11)
) ENGINE=InfiniDB DEFAULT CHARSET=utf8;
[/code]

but i am receiving the following error:

Quote:
The syntax or the data type(s) is not supported by InfiniDB. Please check the InfiniDB syntax guide for supported syntax or data types.

If i change the table name to 'dates' and re-execute the above query it will work just fine:

[code]
CREATE TABLE IF NOT EXISTS `dates` (
`date_id` int(11)
) ENGINE=InfiniDB DEFAULT CHARSET=utf8;
[/code]

Is this a bug or simply the 'date' keyword for tables is reserved by InfiniDB?

Cheers

arekanderu
arekanderu's picture
Offline
Last seen: 3 years 3 weeks ago
Joined: May 17 2010
Senior Boarder

Posts: 31

arekanderu arekanderu
Re: Error when table name is 'date'

Some further info. The following query wont work either.

[code]
CREATE TABLE IF NOT EXISTS `dates` (
`date` varchar(10)
) ENGINE=InfiniDB DEFAULT CHARSET=utf8;
[/code]

If you notice, the table name is 'dates' but the column name is 'date' which again, causes data type error. If i change it to 'dates' it works fine.

[code]
CREATE TABLE IF NOT EXISTS `dates` (
`dates` varchar(10)
) ENGINE=InfiniDB DEFAULT CHARSET=utf8;
[/code]

So, in summary, if i use 'date' as table name or column name i get data type error.

arekanderu
arekanderu's picture
Offline
Last seen: 3 years 3 weeks ago
Joined: May 17 2010
Senior Boarder

Posts: 31

arekanderu arekanderu
Re: Error when table name is 'date'

Further info: It seems that 'action' as table name or column will cause the same problem. I assume that other mysql keywords will cause the same problem with InfiniDB.

I forgot to mention that i am using Calpont InfiniDB Community 2.2.1-1 Final

radams
radams's picture
Offline
Last seen: 2 days 21 hours ago
Joined: Jan 3 2011
Administrator

Posts: 492

Robert Adams
Re: Error when table name is 'date'

Hi arekanderu,

InfiniDB does have some mysql keywords words that cannot be used as table-names or column-names. This is related to how we parse the sql syntax. The words 'date' and 'action' are
examples of table and column names that are not allowed.

Thank you,

Robert
Calpont

arekanderu
arekanderu's picture
Offline
Last seen: 3 years 3 weeks ago
Joined: May 17 2010
Senior Boarder

Posts: 31

arekanderu arekanderu
Re: Error when table name is 'date'

Hello Robert,

Thank you for your reply. This is bad to hear :/ Is there a related document/faq about this with words that are not allowed which I can have a look at?

If not, then I think it should be mentioned somewhere because I am pretty sure other people will fall into the same trap.