-
Notifications
You must be signed in to change notification settings - Fork 3.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
sql: internal error with BUCKET_COUNT = NULL #131212
sql: internal error with BUCKET_COUNT = NULL #131212
Conversation
It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR? 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
69450e1
to
ff5e3cd
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.
Looks good. I just had a comment on the error message used.
Reviewed 2 of 2 files at r1, all commit messages.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @vidit-bhat)
pkg/sql/catalog/tabledesc/table.go
line 290 at r1 (raw file):
// Check if shardBuckets is NULL if shardBuckets == tree.DNull { return 0, pgerror.Newf(pgcode.InvalidParameterValue, `"BUCKET_COUNT" cannot be NULL`)
Can we use invalidBucketCountMsg
as the error message? I believe it still makes sense even when the count is NULL.
537d082
to
18ae65a
Compare
Done |
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.
Reviewed 2 of 2 files at r2.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @vidit-bhat)
pkg/sql/catalog/tabledesc/table.go
line 290 at r2 (raw file):
// Check if shardBuckets is NULL if shardBuckets == tree.DNull { return 0, pgerror.Newf(pgcode.InvalidParameterValue, invalidBucketCountMsg, buckets)
Can we pass in "NULL" for the 3rd parm? I'm hoping the error message will say we passed in NULL if we do.
Suggestion:
return 0, pgerror.Newf(pgcode.InvalidParameterValue, invalidBucketCountMsg, "NULL")
Previously, the `EvalShardBucketCount` function did not properly handle the case where `BUCKET_COUNT` was set to `NULL`, causing evaluation errors. This change adds explicit handling for `NULL` values, ensuring that `BUCKET_COUNT` cannot be set to `NULL` and returns an appropriate error message. Also added a check for NULL before sanitizing and evaluating shardBuckets to avoid invalid operations on NULL values. returns the error `BUCKET_COUNT cannot be NULL`. Epic: none Fixes: cockroachdb#130353 Release note: None
18ae65a
to
1bdef16
Compare
Oops yes. Updated. |
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.
Reviewed 2 of 2 files at r3, all commit messages.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @vidit-bhat)
TFTR! |
we should backport this fix, since older branches are affected and the issue was causing a crash blathers backport 23.1 23.2 24.1 24.2 |
Previously, the
EvalShardBucketCount
function did not properly handle the case whereBUCKET_COUNT
was set toNULL
, causing evaluation errors. This change adds explicit handling forNULL
values, ensuring thatBUCKET_COUNT
cannot be set toNULL
and returns an appropriate error message.Epic: none
Fixes: #130353
Release note: None