Skip to content

sql: make errors point to recorded view commands #13445

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

Merged
merged 2 commits into from
Jul 6, 2022

Conversation

teskje
Copy link
Contributor

@teskje teskje commented Jul 5, 2022

When a user tries to use regular view commands (DROP VIEW, SHOW CREATE VIEW, ALTER VIEW) on recorded views, point them to the correct RECORDED VIEW commands in the error messages.

Motivation

  • This PR adds a known-desirable feature.

Part of MaterializeInc/database-issues#3692.

Tips for reviewer

The error messages are not optimal, because we lack the ability to return AdapterErrors inside the sql code (see my inline comment for more detail). If someone can think of a way to improve this without completely refactoring the crate's error handling, let me know!

Testing

  • This PR has adequate test coverage / QA involvement has been duly considered.

Release notes

This PR includes the following user-facing behavior changes:

  • Improve error messages when trying to use view commands with recorded views.

@teskje teskje marked this pull request as ready for review July 5, 2022 08:50
@teskje teskje requested review from jkosh44 and benesch July 5, 2022 08:50
Copy link
Contributor

@jkosh44 jkosh44 left a comment

Choose a reason for hiding this comment

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

LGTM

@benesch
Copy link
Contributor

benesch commented Jul 5, 2022

Mind holding off on this one for a day, @teskje? I want to see if I can use this as motivation to plumb PlanError through more of the sql crate.

@teskje
Copy link
Contributor Author

teskje commented Jul 5, 2022

@benesch Of course!

benesch added a commit to benesch/materialize that referenced this pull request Jul 5, 2022
Most of the functions still produce only PlanError::Unstructured, but
this will allow us to incrementally move each error to a structured
error type.

This allows the error structure to be propagated upwards to the
coordinator when it exists, which will allow the structured SQL errors
to return hints and long form descriptions.

In particular, after this change, the error messages under construction
in MaterializeInc#13445 will be able to properly emit hints.
@benesch
Copy link
Contributor

benesch commented Jul 5, 2022

Ok, done in #13455!

benesch added a commit to benesch/materialize that referenced this pull request Jul 5, 2022
Most of the functions still produce only PlanError::Unstructured, but
this will allow us to incrementally move each error to a structured
error type.

This allows the error structure to be propagated upwards to the
coordinator when it exists, which will allow the structured SQL errors
to return hints and long form descriptions.

In particular, after this change, the error messages under construction
in MaterializeInc#13445 will be able to properly emit hints.
benesch added a commit to benesch/materialize that referenced this pull request Jul 5, 2022
Most of the functions still produce only PlanError::Unstructured, but
this will allow us to incrementally move each error to a structured
error type.

This allows the error structure to be propagated upwards to the
coordinator when it exists, which will allow the structured SQL errors
to return hints and long form descriptions.

In particular, after this change, the error messages under construction
in MaterializeInc#13445 will be able to properly emit hints.
benesch added a commit that referenced this pull request Jul 5, 2022
Most of the functions still produce only PlanError::Unstructured, but
this will allow us to incrementally move each error to a structured
error type.

This allows the error structure to be propagated upwards to the
coordinator when it exists, which will allow the structured SQL errors
to return hints and long form descriptions.

In particular, after this change, the error messages under construction
in #13445 will be able to properly emit hints.
When a user tries to use regular view commands (DROP VIEW, SHOW CREATE
VIEW, ALTER VIEW) on recorded views, point them to the correct RECORDED
VIEW commands in the error messages.
@teskje teskje force-pushed the recorded-view-friendly-errors branch from 140be90 to c946920 Compare July 6, 2022 09:57
@teskje teskje requested a review from jkosh44 July 6, 2022 10:04
Copy link
Contributor

@jkosh44 jkosh44 left a comment

Choose a reason for hiding this comment

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

LGTM

@teskje
Copy link
Contributor Author

teskje commented Jul 6, 2022

cc @philip-stoev: This solves item no. 2, 3, and 5 from #13346.

@teskje teskje merged commit 3345ec3 into MaterializeInc:main Jul 6, 2022
@teskje teskje deleted the recorded-view-friendly-errors branch July 6, 2022 16:50
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.

3 participants