Environment
- Wappler version: 7.9.5
- NodeJS target
- PostgreSQL (Supabase)
Description
I'm experiencing inconsistent behavior with the PostgreSQL search_path when using a Supabase database connection in Wappler.
My application uses a schema-per-tenant approach. Before executing queries, the connection's search_path is set to the tenant schema (for example schema_102 ).
However, under certain circumstances, queries appear to execute against the public schema instead of the configured tenant schema. This does not happen consistently and seems related to connection reuse or pooling.
Expected behavior
Once the connection has been configured with a specific search_path , all queries executed within the same request should use that schema consistently.
Alternatively, if connections are pooled/reused, Wappler should ensure that the configured search_path is applied before executing queries.
Actual behavior
Occasionally, queries are executed against the public schema even though the application expects the tenant schema to be active.
This can result in:
- Data being read from the wrong schema
- Missing table errors
- Cross-tenant data isolation issues
Steps to reproduce
- Connect Wappler to a Supabase PostgreSQL database.
- Create multiple schemas (e.g.
schema_101,schema_102). - Configure the connection or request to use a specific
search_path. - Execute queries without fully qualifying schema names.
- After multiple requests, observe that some queries unexpectedly run against the
publicschema.
Additional notes
This behavior may be related to:
- PostgreSQL connection pooling
- Reuse of existing database connections
search_pathnot being reapplied when a pooled connection is reused