apps/docs/content/troubleshooting/disabling-prepared-statements-qL8lEL.mdx
Each ORM or library configures prepared statements differently. Here are settings for some common ones. If you don't see yours, make a comment
add ?pgbouncer=true to end of connection string:
postgres://[db-user].[project-ref]:[db-password]@aws-0-[aws-region].pooler.supabase.com:6543/[db-name]?pgbouncer=true
Add a prepared false flag to the client:
export const client = postgres(connectionString, { prepare: false })
Just omit the "name" value in a query definition:
const query = {
name: 'fetch-user', // <--------- DO NOT INCLUDE
text: 'SELECT * FROM user WHERE id = $1',
values: [1],
}
set the prepare_threshold to None.
Follow the recommendation in the asyncpg docs
disable automatic use of prepared statements by passing
statement_cache_size=0to asyncpg.connect() and asyncpg.create_pool() (and, obviously, avoid the use of Connection.prepare());
tokio-postgres: