Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better explanation on errors #25

Closed
unknwon opened this issue Sep 6, 2015 · 9 comments
Closed

Better explanation on errors #25

unknwon opened this issue Sep 6, 2015 · 9 comments

Comments

@unknwon
Copy link
Contributor

unknwon commented Sep 6, 2015

Hi,

I'm using https://github.com/go-xorm/tidb as driver for xorm, and when xorm executes following command:

SELECT `TABLE_NAME`, `ENGINE`, `TABLE_ROWS`, `AUTO_INCREMENT` from `INFORMATION_SCHEMA`.`TABLES` WHERE `TABLE_SCHEMA`=? AND (`ENGINE`='MyISAM' OR `ENGINE` = 'InnoDB') [data/gogs.tidb]

TiDB gives me error:

[error] Compile sql error: use gogs.tidb - 1:9 expected one of [$end, ';', CHARACTER, CHARSET, COLLATE, DEFAULT]

So, which exactly this 1:9 points to? Maybe error message can be more clear like how MySQL does:

xxx near "my statement"

Or

expect xx but found yy 

can be very helpful, too!

Thanks!

@shenli
Copy link
Member

shenli commented Sep 6, 2015

Hello Unknwon,
"1:9" means there is an error near line 1 and column 9.
For your error log, there is a compile error in "use gogs.tidb" near the dot (the 9th character). I check parser/parser.y and find that use statement does not allow dbname with a dot. See: https://github.com/pingcap/tidb/blob/master/parser/parser.y#L3268

Thanks!

shenli added a commit that referenced this issue Sep 7, 2015
Make syntax log easy to read.

#25
@shenli
Copy link
Member

shenli commented Sep 7, 2015

@unknwon please review this #33

Current error log looks like this:
tidb> use gogs.tidb;
2015/09/07 12:36:20 session.go:123: [error] Syntax error: use gogs.tidb;
2015/09/07 12:36:20 session.go:124: [error] Error occurs at line 1 column 9 near ".".

@unknwon
Copy link
Contributor Author

unknwon commented Sep 7, 2015

OK, thanks!

But please add this to docs.

@unknwon
Copy link
Contributor Author

unknwon commented Sep 7, 2015

Just tested again without dot in db name:

2015/09/07 05:32:52 session.go:123: [error] Compile sql error: use gogs-tidb - 1:9 expected one of [$end, ';', CHARACTER, CHARSET, COLLATE, DEFAULT]
[xorm] [info]  2015/09/07 05:32:52.159445 [sql] SELECT `TABLE_NAME`, `ENGINE`, `TABLE_ROWS`, `AUTO_INCREMENT` from `INFORMATION_SCHEMA`.`TABLES` WHERE `TABLE_SCHEMA`=? AND (`ENGINE`='MyISAM' OR `ENGINE` = 'InnoDB') [data/gogs-tidb]

Exactly same error... is it really about database name?

@unknwon
Copy link
Contributor Author

unknwon commented Sep 7, 2015

My bad.... - can't be used either. 😭

@mathiasrw
Copy link

@unknwon try _

@shenli
Copy link
Member

shenli commented Sep 7, 2015

@unknwon we only support letters, numbers and '_' in dbname and it must starts with a letter. Try gogs_tidb please.
You got the old style error log? Have you pulled the latest code and rebuild TiDB?

@unknwon
Copy link
Contributor Author

unknwon commented Sep 7, 2015

Thank you both @mathiasrw @shenli

Please put that on docs... it is very confusing.

@unknwon unknwon closed this as completed Sep 7, 2015
@shenli
Copy link
Member

shenli commented Sep 7, 2015

I will improve the docs. Thanks!

YuJuncen pushed a commit to YuJuncen/tidb that referenced this issue Apr 23, 2021
YuJuncen pushed a commit to YuJuncen/tidb that referenced this issue Apr 23, 2021
* add network check in backer
okJiang pushed a commit to okJiang/tidb that referenced this issue Oct 19, 2021
* tests: test dumping result sorted by primary key

* tests: add primary_key integration test

* tests: remove MySQL incompatible 'DEFAULT NULL' in naughty_strings

* tests: fix bash scripts mistakes
crazycs520 added a commit to crazycs520/tidb that referenced this issue Jan 7, 2022
Connor1996 pushed a commit to Connor1996/tidb that referenced this issue Dec 14, 2022
guoshouyan pushed a commit to guoshouyan/tidb that referenced this issue Mar 5, 2024
YuJuncen pushed a commit to YuJuncen/tidb that referenced this issue Sep 12, 2024
implement split start key on compacted ssts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants