MySQL Forums
Forum List  »  Optimizer & Parser

Need help with tracing how identifiers are parsed; dot-reserved vs dot-space-reserved
Posted by: Justin Ng
Date: May 25, 2021 05:28AM

The following are subtly different.

+ `CREATE TABLE s.SELECT (X INT);`
+ `CREATE TABLE s. SELECT (X INT);`

The first statement will create a table named `SELECT`, under the schema `s`.

The second statement will get a parse error.

> ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT (X INT)' at line 1

-----

The difference is whether a space exists after the identifier separator or not.

I tried looking into the MySQL source code but could not find where this check is performed and what is raising the error.

I've looked at the `table_ident` rule in `sql_yacc.yy`, and states `MY_LEX_IDENT_SEP, MY_LEX_START, MY_LEX_IDENT` in `sql_lex.cc`. I've also looked at `Table_ident` in `sql_lex.h/sql_lex.cc`.

However, I could not figure it out.

Could someone point me in the right direction, short of having me compile and debug from source?

Options: ReplyQuote


Subject
Views
Written By
Posted
Need help with tracing how identifiers are parsed; dot-reserved vs dot-space-reserved
524
May 25, 2021 05:28AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.