Skip to content

Commit

Permalink
Helper SQL: Explicitly include QUERY_CANCELED in exception catching
Browse files Browse the repository at this point in the history
Per the Postgres documentation at https://www.postgresql.org/docs/current/plpgsql-control-structures.html#PLPGSQL-ERROR-TRAPPING
"The special condition name OTHERS matches every error type except
QUERY_CANCELED and ASSERT_FAILURE.", thus we need to explicitly include
the QUERY_CANCELED in order to deallocate the statement in case of
statement timeouts. Since we don't use asserts, we do not need to catch
ASSERT_FAILURE.
  • Loading branch information
lfittl committed Dec 31, 2024
1 parent e9bf24b commit 3ffc8b3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion util/explain_analyze_helper.sql
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ BEGIN
EXECUTE 'PREPARE pganalyze_explain_analyze ' || param_types_str || ' AS ' || prepared_query;
BEGIN
EXECUTE explain_prefix || 'EXECUTE pganalyze_explain_analyze' || params_str INTO STRICT result;
EXCEPTION WHEN OTHERS THEN
EXCEPTION WHEN QUERY_CANCELED OR OTHERS THEN
DEALLOCATE pganalyze_explain_analyze;
RAISE;
END;
Expand Down

0 comments on commit 3ffc8b3

Please sign in to comment.