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

cli: report partial result rows in case of error #45872

Merged
merged 1 commit into from
Mar 9, 2020

Conversation

knz
Copy link
Contributor

@knz knz commented Mar 9, 2020

First half of the work for #45833. (The other half is delaying notices to the end - will send a different PR.)

Before this patch:

root@127.0.0.1:61756/defaultdb> select 1/(@1-10) from generate_series(1,11);
ERROR: division by zero
SQLSTATE: 22012

After:

root@127.0.0.1:61756/defaultdb> select 1/(@1-10) from generate_series(1,11);
         ?column?
---------------------------
  -0.11111111111111111111
                   -0.125
  -0.14285714285714285714
  -0.16666666666666666667
                     -0.2
                    -0.25
  -0.33333333333333333333
                     -0.5
                       -1
(9 rows)
(error encountered after some results rows were delivered)
ERROR: division by zero
SQLSTATE: 22012

Release note (cli change): In case some result rows have already been
received from the server when an error is encountered, CockroachDB's
SQL shell (cockroach sql/demo) now present both the result rows and
the error in the output regardless of the selected table
formatter. Previously, only the error was reported with some
formatters, or both with other formatters.

@knz knz requested a review from RaduBerinde March 9, 2020 10:35
@knz knz requested a review from a team as a code owner March 9, 2020 10:35
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Member

@RaduBerinde RaduBerinde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm: Thanks!!

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @RaduBerinde)

Before this patch:

```
root@127.0.0.1:61756/defaultdb> select 1/(@1-10) from generate_series(1,11);
ERROR: division by zero
SQLSTATE: 22012
```

After:

```
root@127.0.0.1:61756/defaultdb> select 1/(@1-10) from generate_series(1,11);
         ?column?
---------------------------
  -0.11111111111111111111
                   -0.125
  -0.14285714285714285714
  -0.16666666666666666667
                     -0.2
                    -0.25
  -0.33333333333333333333
                     -0.5
                       -1
(9 rows)
(error encountered after some results rows were delivered)
ERROR: division by zero
SQLSTATE: 22012
```

Release note (cli change): In case some result rows have already been
received from the server when an error is encountered, CockroachDB's
SQL shell (`cockroach sql/demo`) now present both the result rows and
the error in the output regardless of the selected table
formatter. Previously, only the error was reported with some
formatters, or both with other formatters.
@knz knz merged commit 4171c7b into cockroachdb:master Mar 9, 2020
@knz knz deleted the 20200309-cli-res branch March 9, 2020 15:03
@knz knz mentioned this pull request Mar 14, 2020
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.

None yet

3 participants