Investigate alternatives to using `search_path` to distinguish schema versions
pgroll uses the Postgres search_path setting to determine which schema version the user is accessing. Applications are expected to set the search_path either after connection or as part of the connection string as described [in the docs](https://pgroll.com/docs/latest/guides/clientapps).
The search_path is checked by the up and down triggers used by pgroll to determine whether the trigger should take action or not. For example:
DECLARE
"id" "public"."items"."id"%TYPE := NEW."id";
"name" "public"."items"."name"%TYPE := NEW."name";
latest_schema text;
search_path text;
BEGIN
SELECT current_setting('search_path')
INTO search_path;
IF search_path != 'public_02_create_constraint' THEN
NEW."_pgroll_new_name" = (SELECT lpad(name, 3, '_'));
NEW."_pgroll_needs_backfill" = false;
END IF;
RETURN NEW;
END;Users have expressed concerns about this approach when they are already setting the application’s search_path for different purposes. We should investigate alternatives here. One potential solution could be for applications to set a session level custom config parameter on connection to indicate which version they want to connect to.
Source: xataio/pgroll