-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Open
Labels
bug/1-unconfirmedBug should have enough information for reproduction, but confirmation has not happened yet.Bug should have enough information for reproduction, but confirmation has not happened yet.kind/bugA reported bug.A reported bug.topic: driverAdapterstopic: postgresqltopic: typedSql
Description
Bug description
Hey there!
I've been playing around with TypedSQL and so far, it's been awesome! That being said, I'm now trying to use the Postgres driver adapter but this causes all TypedSQL queries to break.
PrismaClientKnownRequestError:
Invalid `prisma.$queryRawTyped()` invocation:
Raw query failed. Code: `42P01`. Message: `relation "MyTable" does not exist`
This is exclusive to TypedSQL queries. Typical ORM queries (prisma.myTable.findMany()) correctly make use of the schema.
Severity
Reproduction
Create a typedsql script
-- prisma/sql/myQuery.sql
SELECT * FROM "MyTable";Run prisma, call script
// File.ts
const adapter = new PrismaPg(
{ connectionString: ... },
{ schema: 'my_schema' }
);
const prisma = new PrismaClient({
adapter,
});
// Run ORM query (works fine)
console.log(await prisma.myTable.findMany({ take: 1 }));
// Run typed sql query - errors
console.log(await prisma.$queryRawTyped(myQuery()))Expected vs. Actual Behavior
Expected: Resulting TypedSQL query contains my_schema."MyTable"
Actual: Resulting TypedSQL query ignores any schema configuration
Frequency
Consistently reproducible
Does this occur in development or production?
Both development and production
Is this a regression?
Unknown
Workaround
No known workaround
Prisma Schema & Queries
N/A
Prisma Config
See repro above
Logs & Debug Info
See above
Environment & Setup
- OS: macOS
- Database: PostgreSQL
- Node.js version: 23
Prisma Version
prisma : 6.6.0
@prisma/client : 6.6.0
Computed binaryTarget : darwin-arm64
Operating System : darwin
Architecture : arm64
Node.js : v23.8.0
TypeScript : 5.8.2
Query Engine (Node-API) : libquery-engine f676762280b54cd07c770017ed3711ddde35f37a (at node_modules/@prisma/engines/libquery_engine-darwin-arm64.dylib.node)
Schema Engine : schema-engine-cli f676762280b54cd07c770017ed3711ddde35f37a (at node_modules/@prisma/engines/schema-engine-darwin-arm64)
Schema Wasm : @prisma/prisma-schema-wasm 6.6.0-53.f676762280b54cd07c770017ed3711ddde35f37a
Default Engines Hash : f676762280b54cd07c770017ed3711ddde35f37a
Studio : 0.511.0
Preview Features : driverAdapters, metrics, typedSql
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bug/1-unconfirmedBug should have enough information for reproduction, but confirmation has not happened yet.Bug should have enough information for reproduction, but confirmation has not happened yet.kind/bugA reported bug.A reported bug.topic: driverAdapterstopic: postgresqltopic: typedSql