Skip to content

Commit 37fc8b2

Browse files
docs(sdb): add tb on SET search path errors MTA-6584 (#5642)
1 parent 02857e1 commit 37fc8b2

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

pages/serverless-sql-databases/reference-content/known-differences.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ Serverless SQL Databases support the most popular PostgreSQL extensions. Refer t
117117
```
118118
In this example, `SHOW timezone` will always display `Europe/Paris` without any impact from any other connection despite connection pooling.
119119

120+
- `SET search_path TO` commands to use schemas works, but will be shared across multiple clients due to connection pooling, and will lead to unwanted effects. Refer to the [dedicated troubleshooting page](/serverless-sql-databases/troubleshooting/search-path-schema-errors/) for more information.
121+
120122
- Security labels cannot be defined or changed.
121123

122124
```sql

pages/serverless-sql-databases/troubleshooting/index.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,5 @@ productIcon: ServerlessDbProductIcon
4444
- [Solving Serverless SQL Databases connection timeouts](/serverless-sql-databases/troubleshooting/connection-timeout)
4545
- [Solving failing manual backup and restore operations](/serverless-sql-databases/troubleshooting/failing-backup-restore)
4646
- [Solving maximum prepared statements size errors](/serverless-sql-databases/troubleshooting/maximum-prepared-statements-reached)
47+
- [Solving issues when setting search path to a schema](/serverless-sql-databases/troubleshooting/search-path-schema-errors/)
4748
</LinksList>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
title: Solving errors while setting search path to schemas
3+
description: This page contains information to troubleshoot problems encountered while using SET search_path TO schema requests.
4+
tags: set search path to schema error problem bug 500 connection lost db pgbouncer pooling
5+
dates:
6+
validation: 2025-10-10
7+
posted: 2025-10-10
8+
---
9+
10+
## Problem
11+
12+
I am experiencing issues while using `SET` commands such as the following:
13+
14+
```sql
15+
SET search_path TO my_schema
16+
```
17+
18+
## Cause
19+
20+
- `SET search_path TO` commands to use schemas works, but will be shared across multiple clients due to connection pooling, and will lead to unwanted effects.
21+
22+
## Possible solutions
23+
24+
- Use fully qualified schema names (`schema.table`) to perform stateless and self-contained transactions that do not rely on or modify session-level settings.
25+
26+
- Perform the `SET` command in the same transaction as the request, using the `SET LOCAL` command so it applies to the current transaction only:
27+
28+
```sql
29+
BEGIN;
30+
SET LOCAL search_path TO schema1;
31+
SELECT ... ;
32+
COMMIT;
33+
```

0 commit comments

Comments
 (0)