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

Function as identifier in Tidb is not compatible with Mysql(5.7 and 8.0) #30556

Closed
ramanich1 opened this issue Dec 8, 2021 · 2 comments · Fixed by #31803
Closed

Function as identifier in Tidb is not compatible with Mysql(5.7 and 8.0) #30556

ramanich1 opened this issue Dec 8, 2021 · 2 comments · Fixed by #31803
Assignees
Labels
severity/moderate sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.

Comments

@ramanich1
Copy link
Collaborator

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

set SQL_MODE='';
drop table if exists  ADDDATE;
create table ADDDATE(a int); 
drop table ADDDATE;
create table ADDDATE (a int);

-- Tidb is treating function ADDDATE as identifer only when a blank space is given in  between ADDDATE (a int);
--Similar functions :
--SESSION_USER	
--SUBDATE
--SYSTEM_USER

2. What did you expect to see? (Required)

mysql> create table ADDDATE(a int); 
Query OK, 0 rows affected (0.01 sec)

mysql> drop table ADDDATE;
Query OK, 0 rows affected (0.00 sec)

mysql> create table ADDDATE (a int);
Query OK, 0 rows affected (0.01 sec)

3. What did you see instead (Required)

mysql> create table ADDDATE(a int); 
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use line 1 column 20 near "ADDDATE(a int)" 
mysql> drop table ADDDATE;
ERROR 1051 (42S02): Unknown table 'test.ADDDATE'
mysql> create table ADDDATE (a int);
Query OK, 0 rows affected (0.00 sec)

4. What is your TiDB version? (Required)

| Release Version: v5.4.0-alpha-264-g6efa36df6
Edition: Community
Git Commit Hash: 6efa36df6cff325106f67ecfe3d79816ba37ca6a
Git Branch: master
UTC Build Time: 2021-11-29 16:57:51
GoVersion: go1.17.2
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false |
@ramanich1 ramanich1 added the type/bug The issue is confirmed as a bug. label Dec 8, 2021
@djshow832 djshow832 self-assigned this Jan 17, 2022
@djshow832
Copy link
Contributor

This is weird: according to MySQL document (https://dev.mysql.com/doc/refman/8.0/en/function-resolution.html), ADDDATE should be treated as a function without whitespace between the name and (. It should act as other functions in the list, like COUNT.
However, COUNT obeys the rule but ADDDATE doesn't.

@github-actions
Copy link

Please check whether the issue should be labeled with 'affects-x.y' or 'fixes-x.y.z', and then remove 'needs-more-info' label.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/moderate sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants