Skip to content
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: ignore empty statements during Prepare #9811

Merged
merged 1 commit into from
Oct 10, 2016
Merged

sql: ignore empty statements during Prepare #9811

merged 1 commit into from
Oct 10, 2016

Conversation

maddyblue
Copy link
Contributor

@maddyblue maddyblue commented Oct 7, 2016

Fixes #9093
Fixes #9518


This change is Reviewable

@a-robinson
Copy link
Contributor

:lgtm:


Reviewed 3 of 3 files at r1.
Review status: all files reviewed at latest revision, 1 unresolved discussion, some commit checks failed.


sql/pgwire_test.go, line 848 at r1 (raw file):

              }
          } else {
              if rowsAffected, _ := result.RowsAffected(); rowsAffected != test.rowsAffected {

Why do we no longer want to check the error?


Comments from Reviewable

@tamird
Copy link
Contributor

tamird commented Oct 7, 2016

Reviewed 3 of 3 files at r1.
Review status: all files reviewed at latest revision, 2 unresolved discussions, some commit checks failed.


sql/executor.go, line 349 at r1 (raw file):

      return nil, err
  }
  if len(stmts) > 1 {
switch len(stmts) {
...
}

sql/pgwire_test.go, line 848 at r1 (raw file):

Previously, a-robinson (Alex Robinson) wrote…

Why do we no longer want to check the error?

+1, let's still check it (string comparison, womp womp).

Comments from Reviewable

@maddyblue
Copy link
Contributor Author

Review status: all files reviewed at latest revision, 2 unresolved discussions, some commit checks failed.


sql/pgwire_test.go, line 848 at r1 (raw file):

Previously, tamird (Tamir Duberstein) wrote…

+1, let's still check it (string comparison, womp womp).

Because in this specific case it's really, really stupid. We have to add a new property that is the rowsAffectedError (can't use the existing error field because that's used for something else) and then do the thing to make sure both have the same error or neither do. It's a more lines of code for just the stupidest error. But whatever I'll add it.

Comments from Reviewable

@knz
Copy link
Contributor

knz commented Oct 10, 2016

:lgtm:


Review status: all files reviewed at latest revision, 2 unresolved discussions, some commit checks failed.


sql/pgwire_test.go, line 848 at r1 (raw file):

Previously, mjibson (Matt Jibson) wrote…

Because in this specific case it's really, really stupid. We have to add a new property that is the rowsAffectedError (can't use the existing error field because that's used for something else) and then do the thing to make sure both have the same error or neither do. It's a more lines of code for just the stupidest error. But whatever I'll add it.

No, just keep it simple:
if rowsAffected, err := result.RowsAffected(); rowsAffected != test.rowsAffected {
  t.Errorf("%s: %v: expected %v, got %v (error %+v)", query, test.qargs, test.rowsAffected, rowsAffected, err)
}

No need for an additional test field.


Comments from Reviewable

@knz knz self-assigned this Oct 10, 2016
@maddyblue
Copy link
Contributor Author

Review status: all files reviewed at latest revision, 2 unresolved discussions, some commit checks failed.


sql/pgwire_test.go, line 848 at r1 (raw file):

Previously, knz (kena) wrote…

No, just keep it simple:

if rowsAffected, err := result.RowsAffected(); rowsAffected != test.rowsAffected {
  t.Errorf("%s: %v: expected %v, got %v (error %+v)", query, test.qargs, test.rowsAffected, rowsAffected, err)
}

No need for an additional test field.

This won't catch the case where rowsAffected returns 0 and an error if test.rowsAffected is also 0.

Comments from Reviewable

@maddyblue maddyblue merged commit bffaf5b into cockroachdb:master Oct 10, 2016
@maddyblue maddyblue deleted the prep-empty branch October 10, 2016 20:19
@tamird
Copy link
Contributor

tamird commented Oct 10, 2016

Reviewed 3 of 3 files at r2.
Review status: all files reviewed at latest revision, 3 unresolved discussions, all commit checks successful.


sql/pgwire_test.go, line 855 at r2 (raw file):

          } else {
              rowsAffected, err := result.RowsAffected()
              hasRAErr := err != nil

eh, this could be stronger; in general, we should not accept just any error here; this is what testutils.IsError is for.


Comments from Reviewable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants