Repository navigation
Closed as not planned
Labels
bug/1-unconfirmedBug should have enough information for reproduction, but confirmation has not happened yet.kind/bugA reported bug.tech/enginesIssue for tech Engines.topic: driverAdapterstopic: raw$queryRaw(Unsafe) and $executeRaw(Unsafe): https://www.prisma.io/docs/concepts/components/prisma-cli
Description
Hi, I've been experimenting using the new driverAdapters preview feature with @prisma/adapter-pg so I can use oauth2 token login for Google Cloud SQL which is not currently supported out of the box by prisma.
Our database does not use the public schema, rather it uses one called staging. When using the built in prisma queries, they succeed as expected. However, when I use $queryRaw, raw queries that previously didn't need to be prepended with the schema now fail.
This is my code to instantiate the prisma client:
import { PrismaPg } from "@prisma/adapter-pg";
import { PrismaClient } from "@prisma/client";
import { GoogleAuth } from "google-auth-library";
import { Pool } from "pg";
const auth = new GoogleAuth({
scopes: ["https://www.googleapis.com/auth/sqlservice.login"],
});
const pool = new Pool({
host: "/cloudsql/REDACTED",
user: "REDACTED",
password: async (): Promise<string> => {
return (await auth.getAccessToken()) as string;
},
database: "uat",
ssl: false,
idleTimeoutMillis: 0,
max: 5,
});
const adapter = new PrismaPg(pool, {
schema: "staging",
});
export const prismaClient = new PrismaClient({
adapter,
log: ["info", "warn", "error"],
});This raw query works without the PrismaPg adapter, but fails when I use the adapter:
await prismaClient.$queryRaw`select * from "AccountingPeriod" limit 1`;This raw query succeeds when using the PrismaPg adapter:
await prismaClient.$queryRaw`select * from staging."AccountingPeriod" limit 1`;I'm happy to provide more information if needed!
Reacted by theguacamoleking, TED Vortex (Teodor-Eugen Duțulescu), Tamlyn Rhodes, Jan Wilhelm, Felipe Lima and Austin
Metadata
Metadata
Assignees
Labels
bug/1-unconfirmedBug should have enough information for reproduction, but confirmation has not happened yet.kind/bugA reported bug.tech/enginesIssue for tech Engines.topic: driverAdapterstopic: raw$queryRaw(Unsafe) and $executeRaw(Unsafe): https://www.prisma.io/docs/concepts/components/prisma-cli

Activity
FGoessler commentedon Jan 23, 2025
Hi,
We’ve noticed there hasn’t been activity on this issue for quite some time, and we suspect it might no longer be relevant. As part of our ongoing effort to streamline open issues in this repository, we’re closing this one to focus on what’s most important to our community.
If you believe this issue is still relevant and requires attention, feel free to reopen it. Reopening the issue is a valuable signal to us about what matters most to you.
You can learn more about our approach and motivations in the Prisma ORM Manifesto.
With love,
Your Prisma ORM Team ❤️
jan-wilhelm commentedon Sep 2, 2025
This is still an issue!
ofabricio25 commentedon Jan 2, 2026
I had same issue
fix(adapter-pg): set search_path for custom schemas in $queryRaw (pri…
revert(adapter-pg): stop setting search_path from the schema option (…