-
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
server, mysql: return correct column name and column label name #7600
Conversation
For a little complicated one |
For expression support regarding this problem, it is more complicated. For example, if we are using this query: select avg(a) as alias from t; currently, parser would recognize the patterns in the sql text, build corresponding ASTs, but would not store the map between AST and original text, except for few expressions such as In this case, Two approaches to get this
Both approaches are not perfect from my perspective, considered that JDBC has clarified in 4.0 specification that users should use column label to get data, instead of column name, I prefer not to extent this PR to expressions now. |
@winoros MySQL and TiDB has same behavior after this PR: |
/run-all-tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@coocood PTAL |
LGTM |
What problem does this PR solve?
Make returned column name and column label compatible with MySQL protocol/JDBC specification. Check out this example using JDBC to connect to TiDB:
before this PR, both
nameField
andaliasField
arefake
; after this PR,nameField
isa
, andaliasField
isfake
What is changed and how it works?
distinguish column label and column name
Check List
Tests
Related changes
return correct column name and column label name