Skip to content

fix: return error and terminate pool on invalid search path, psql integration tests#860

Merged
v0idpwn merged 6 commits into
mainfrom
invalid-search-path-handling-psql-based-tests
Feb 12, 2026
Merged

fix: return error and terminate pool on invalid search path, psql integration tests#860
v0idpwn merged 6 commits into
mainfrom
invalid-search-path-handling-psql-based-tests

Conversation

@v0idpwn
Copy link
Copy Markdown
Member

@v0idpwn v0idpwn commented Feb 12, 2026

Work on top of #770.

The tests revealed an interesting failure mode: previously, an invalid search path would crash the DbHandler, which would be restarted by the Supervisor and crash loop. This makes it terminate the pool.

Additionally, they revealed that we needed to escape the data again before sending it to the upstream db, which I also do in this PR. While implementing that, I noticed some quirks of pgsql escaping and implemented ours accordingly.

b3b and others added 3 commits November 1, 2025 18:27
- Adds an integration suite that verifies correct behavior of PGOPTIONS
  parsing and propagation.
- Updates CI workflow to ensure the psql client is available for integration runs.
- Increases test max_pools to accommodate additional tenants.
Additionally, adapts psql tests for the new behaviour, and removes
the log_level test (won't properly work that way).
@v0idpwn v0idpwn requested a review from a team as a code owner February 12, 2026 07:43
@v0idpwn v0idpwn changed the title Invalid search path handling psql based tests fix: return error and terminate pool on invalid search path, psql integration tests Feb 12, 2026
Comment on lines +340 to +345
{:error_response, %{"S" => "FATAL", "C" => "22023"} = error} ->
Logger.error("DbHandler: Invalid parameter value: #{inspect(error)}")

{:keep_state_and_data,
{:next_event, :internal, {:terminate_with_error, error, :shutdown_pool}}}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This ensures that we don't enter a retry loop when we have some invalid search path

Comment thread lib/supavisor/protocol/startup_options.ex Outdated
Comment thread lib/supavisor/protocol/startup_options.ex Outdated
Copy link
Copy Markdown
Contributor

@mentels mentels left a comment

Choose a reason for hiding this comment

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

LGTM!

@v0idpwn v0idpwn merged commit eeead12 into main Feb 12, 2026
13 of 14 checks passed
@v0idpwn v0idpwn deleted the invalid-search-path-handling-psql-based-tests branch February 12, 2026 16:27
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