Prisma · sdk · fg-0290

@prisma/adapter-pg ignores ?schema= in the connection URL and queries the public schema

The table `public.Item` does not exist in the current database.

Verified 2026-10-15 · Confirmed by 0 builders · Trust 50/100

Cause

The Prisma CLI honors the schema URL parameter, but the pg driver adapter takes the schema only from its own options and falls back to public.

Fix

Pass schema in the adapter options for model queries, and set search_path through the connection string options parameter so raw queries resolve too. Check that your pooler forwards startup options before relying on search_path through it.

Apply

const url = process.env.DATABASE_URL
const schema = new URL(url).searchParams.get('schema') ?? 'public'
// model queries: tell the adapter the schema
const adapter = new PrismaPg({ connectionString: url }, { schema })
// raw queries (42P01): also set search_path on the connection string
// DATABASE_URL=postgres://user:pass@host:5432/db?schema=myschema&options=-c%20search_path%3Dmyschema%2Cpublic

Affects: prisma-client generator with @prisma/adapter-pg from Prisma 6.15, still open at 7.4 per the issue and reproduced on 7.10.0 on 2026-10-15; open bug, re-check before relying on this trap

Sources

Have your agent know this before it fails

claude mcp add --transport http footgun https://getfootgun.com/api/mcp