-
Notifications
You must be signed in to change notification settings - Fork 3.9k
sql: More descriptive error messages in show partitions #39543
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
Conversation
|
Excited about this! |
bump |
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.
Reviewable status:
complete! 0 of 0 LGTMs obtained (waiting on @rohany and @solongordon)
pkg/sql/delegate/show_partitions.go, line 95 at r1 (raw file):
// Throw a more descriptive error if the user did not use the index hint syntax. if tn.TableName == "" { return nil, errors.New("no table specified. Specify a table using the hint syntax of table@index")
You might want to take a look at the errors.WithHint
function to get slightly nicer output. Also it might be nice to attach a pg error code. Here is an example of both:
cockroach/pkg/sql/set_zone_config.go
Lines 476 to 480 in 497167b
err = errors.Wrap(err, "could not validate zone config") | |
err = pgerror.WithCandidateCode(err, pgcode.InvalidParameterValue) | |
err = errors.WithHint(err, | |
"try ALTER ... CONFIGURE ZONE USING <field_name> = COPY FROM PARENT [, ...] to populate the field") | |
return err |
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.
Reviewable status:
complete! 0 of 0 LGTMs obtained (waiting on @solongordon)
pkg/sql/delegate/show_partitions.go, line 95 at r1 (raw file):
Previously, solongordon (Solon) wrote…
You might want to take a look at the
errors.WithHint
function to get slightly nicer output. Also it might be nice to attach a pg error code. Here is an example of both:cockroach/pkg/sql/set_zone_config.go
Lines 476 to 480 in 497167b
err = errors.Wrap(err, "could not validate zone config") err = pgerror.WithCandidateCode(err, pgcode.InvalidParameterValue) err = errors.WithHint(err, "try ALTER ... CONFIGURE ZONE USING <field_name> = COPY FROM PARENT [, ...] to populate the field") return err
Oh, I see. Let me do what this does.
The show partitions statement suggests use of the index hint syntax if the user does not use it. Fixes cockroachdb#39476. Release note: None
dbf4dc5
to
103661c
Compare
@solongordon can you take another quick look and see if this is what you were imagining? |
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.
Yup, lgtm!
Reviewable status:
complete! 0 of 0 LGTMs obtained (waiting on @solongordon)
bors r=solongordon |
39543: sql: More descriptive error messages in show partitions r=solongordon a=rohany The show partitions statement suggests use of the index hint syntax if the user does not use it. Fixes #39476. Release note: None Co-authored-by: Rohan Yadav <[email protected]>
Build succeeded |
The show partitions statement suggests use of the index
hint syntax if the user does not use it.
Fixes #39476.
Release note: None