-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
planner/core: add DefaultExpr support for expressionRewriter #8540
Conversation
4388c08
to
7f89ad9
Compare
7f89ad9
to
2cdd49f
Compare
planner/core/expression_rewriter.go
Outdated
} | ||
|
||
func hasCurrentTimestampDefault(col *table.Column) bool { | ||
if col.Tp != mysql.TypeTimestamp && col.Tp != mysql.TypeDatetime { |
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.
We do not really need this, check the name is enough and clearer.
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.
We need to check the types(for example, to avoid varchar
column with 'current_timestamp
' default string).
What's more, I just found timestamp
and datetime
behaves differently here, so a code update is needed, thanks anyway!
2cdd49f
to
0e19852
Compare
1c1fe38
to
dbee759
Compare
hi @zz-jason , I've updated code, it looks much better now! Thank you very much |
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.
rest lgtm
0e68a66
to
d1b4406
Compare
d1b4406
to
bbd61b7
Compare
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
1. address winoros's comment 2. fixed bugs for decorrlated column/aliased column
use ExecToErr() instead of Exec() in integration tests
bbd61b7
to
2d0c469
Compare
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
/run-all-tests |
Closes #4054 |
What problem does this PR solve?
This PR simply fix a compatibility issue about
default()
function inexpressionRewriter
:default()
function should return the default value of a given column:https://dev.mysql.com/doc/refman/5.7/en/miscellaneous-functions.html#function_default
What is changed and how it works?
In
expressionRewriter
, this PR adds a branch to handleast.DefaultExpr
to avoid theUnknownType
error and fix this issue.Check List
Tests
Related changes
This change is