-
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: add constraint name to constraint error #55660
Conversation
Thank you for contributing to CockroachDB. Please ensure you have followed the guidelines for creating a PR. Before a member of our team reviews your PR, I have some potential action items for you:
I was unable to automatically find a reviewer. You can try CCing one of the following members:
🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan. |
db9c9ca
to
e7968ec
Compare
Thank you for updating your pull request. Before a member of our team reviews your PR, I have some potential action items for you:
I was unable to automatically find a reviewer. You can try CCing one of the following members:
🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan. |
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! I just have a couple of nits.
nit: the commit message should have a title, a body, and a release note (basically what you have in the PR description).
nit: the title of the commit message (and the PR) should start with the name of the package that has changed and the words should be in lower-case, i.e. we want something like sql: add constraint name to errors
.
nit: for the release note, we should specify a category, I think in this case it would be Release note (sql change): ...
.
Reviewed 2 of 2 files at r1.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @alex-berger)
pkg/sql/row/errors.go, line 98 at r1 (raw file):
} error := pgerror.Newf(pgcode.UniqueViolation,
super nit: it might be good to not declare a local variable and return the error right away for consistency with other changes.
Add constraint name to error for unique constraint, check constraint, and foreign key constraint violations. Those constraint names are then propagated over the PostgreSQL wire protocol and will show up for example in JDBC exceptions (org.postgresql.util.PSQLException#getServerErrorMessage().getConstraint()). This commit improves PostgreSQL compatibility of CockroachDB error messages. Release note (sql change): Add constraint name to constraint errors, to increase wire level PostgreSQL compatibility.
e7968ec
to
5d5389d
Compare
Thank you for updating your pull request. My owl senses detect your PR is good for review. Please keep an eye out for any test failures in CI. 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan. |
Thanks! bors r=yuzefovich |
Build succeeded: |
Add constraint name to error for unique constraint, check constraintand foreign key constraint violations. Those constraint names are then propagated over the PostgreSQL wire protocol and will show up for example in JDBC exceptions (org.postgresql.util.PSQLException#getServerErrorMessage().getConstraint()). This commit improves PostgreSQL compatibility.
Release note: Improve PosgreSQL wire protocol compatibility by adding constraint name to sql errors.