-
Notifications
You must be signed in to change notification settings - Fork 12
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
Report non-decimal integer literals #2217
Conversation
return err | ||
} | ||
/* | ||
Caveats can't report this issue for cases like - |
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.
Let's also add a comment explaining where this is useful then - i guess only plpgsql objects?
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.
yeah majorly plpgsql in normal cases, will add a comment
|
||
*/ | ||
switch { | ||
case aConstNode.GetFval() != nil: |
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.
pls add a comment explaining what fval is. (I'm assuming that it means FloatVal)
Why aren't we checking IVal(Integer value)? Why would these be represented as floats, not integers 🤔
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.
yes it's a float val, I am also not sure why this non-decimal integers are coming in fval and not ival but I have only seen cases where ival has decimal integers only.
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.
Added comments, will understand the internals why this is happening
assert.Equal(t, 1, len(issues)) | ||
cmp.Equal(issues[0], expectedIssue) | ||
} | ||
sqlsWithoutIssues := []string{ |
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.
thanks for adding these negative tests. very useful 👍
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
Describe the changes in this pull request
Fixes #1982
Report the non-decimal integer literals wherever possible in DDL, DML and PLPGSQL.
Describe if there are any user-facing changes
New Feature -
Non-decimal integer literal
How was this pull request tested?
Added new unit and end-to-end tests
Does your PR have changes that can cause upgrade issues?