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
Error handling #6
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
olirice
commented
Apr 17, 2023
Comment on lines
1
to
+17
begin; | ||
create extension index_advisor version '0.1.1' cascade; | ||
create extension index_advisor version '0.2.0' cascade; | ||
NOTICE: installing required extension "hypopg" | ||
select index_advisor($$ select 1; $$); | ||
ERROR: query must not contain a semicolon | ||
CONTEXT: PL/pgSQL function index_advisor(text) line 15 at RAISE | ||
-- This is okay because semicolon gets stripped from the end of the statement | ||
select * from index_advisor($$ select 1; $$); | ||
startup_cost_before | startup_cost_after | total_cost_before | total_cost_after | index_statements | errors | ||
---------------------+--------------------+-------------------+------------------+------------------+-------- | ||
0.00 | 0.00 | 0.01 | 0.01 | {} | {} | ||
(1 row) | ||
|
||
-- This is not okay because it contains multiple statements | ||
select * from index_advisor($$ select 1; select 1 $$); | ||
startup_cost_before | startup_cost_after | total_cost_before | total_cost_after | index_statements | errors | ||
---------------------+--------------------+-------------------+------------------+------------------+---------------------------------------- | ||
| | | | {} | {"Query must not contain a semicolon"} | ||
(1 row) | ||
|
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.
you can see the difference here
burggraf
approved these changes
Apr 17, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What kind of change does this PR introduce?
Return errors as text[] rather than raising exception to enable the
index_advisor
function to be applied against multiple queries in a single statement without a single failure causing the whole query to crashresolves #2