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: respect IF NOT EXISTS in CREATE EXTERNAL CONNECTION #117312
Conversation
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 doing this!
@@ -144,6 +144,10 @@ func (p *planner) createExternalConnection( | |||
// Create the External Connection and persist it in the | |||
// `system.external_connections` table. | |||
if err := ex.Create(params.ctx, txn); err != nil { | |||
isNotExists := n.ConnectionLabelSpec.IfNotExists |
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.
nit: s/is/if/r
also, I think a few words in the commit message could be swapped for clearer reading.
Previously, while the IF NOT EXISTS syntax was allowed nothing checked the boolean on the constructed tree node. Here, we check the boolean and elide DuplicateViolation errors from create. Fixes cockroachdb#116997 Release note (bug fix): CREATE EXTERNAL CONNECTION IF NOT EXISTS no longer returns an error if the connection already exists.
05c2dfa
to
e13823c
Compare
bors r=msbutler |
Build failed (retrying...): |
Build succeeded: |
Previously, while the IF NOT EXISTS syntax was allowed nothing checked the boolean on the constructed tree node. Here, we check the boolean and elide DuplicateViolation errors from create.
Fixes #116997
Release note (bug fix): CREATE EXTERNAL CONNECTION IF NOT EXISTS no longer returns an error if the connection already exists.