-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
Can't recognize numeric literals when set 'ANSI_QUOTES' sql_mode #24429
Comments
The problem is related to the table.column identifier, where the column is enclosed in quotes but the table is not. Here is a pasteable testcase with more examples: SET SESSION sql_mode='ANSI_QUOTES';
DROP TABLE IF EXISTS test;
CREATE TABLE test (
"CD_ID" bigint(20) NOT NULL,
"INTEGER_IDX" int(11) NOT NULL,
PRIMARY KEY ("CD_ID")
);
INSERT INTO test VALUES (54603, 1),(54604, 2);
SELECT COUNT(*) FROM "test" THIS WHERE THIS."CD_ID"=54603 AND THIS."INTEGER_IDX">=0; # fails
SELECT COUNT(*) FROM "test" THIS WHERE "THIS"."CD_ID"=54603 AND "THIS"."INTEGER_IDX">=0; # works
SELECT COUNT(*) FROM "test" THIS WHERE "CD_ID"=54603 AND "INTEGER_IDX">=0; # works
SELECT COUNT(*) FROM "test" t WHERE t."CD_ID"=54603 AND t."INTEGER_IDX">=0; # fails
mysql> SELECT tidb_version()\G
*************************** 1. row ***************************
tidb_version(): Release Version: v4.0.0-beta.2-2792-g83f14bf7f-dirty
Edition: Community
Git Commit Hash: 83f14bf7ff45590b9b62b27b6c35a0b7b02ac7fe
Git Branch: security-enhanced-3
UTC Build Time: 2021-05-04 20:18:47
GoVersion: go1.13.15
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: true
1 row in set (0.00 sec)
|
I found that this bug cannot be reproduced in the early releases(v5.0-rc & v4.0), I would call this bug as a regression. Hi @morgo , please try to locate the PR that caused this bug(by |
I've bisected it to #21908 by @xiongjiwei |
Thanks! |
Please edit this comment or add a new comment to complete the following informationNot a bug
Duplicate bug
BugNote: Make Sure that 'component', and 'severity' labels are added 1. Root Cause Analysis (RCA) (optional)2. Symptom (optional)3. All Trigger Conditions (optional)4. Workaround (optional)5. Affected versions6. Fixed versions |
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
2. What did you expect to see? (Required)
On v3.0.3 version, it's ok.
3. What did you see instead (Required)
On v5.0.1:
4. What is your TiDB version? (Required)
The text was updated successfully, but these errors were encountered: