drizzle-team/drizzle-orm · error · Error

Method not implemented.

Error message

Method not implemented.

What it means

PrismaPgPreparedQuery.all() throws 'Method not implemented.' The Prisma PostgreSQL adapter routes execution through $queryRawUnsafe and intentionally does not implement the all() variant (used for raw row arrays in some internal paths). isResponseInArrayMode() is also overridden to return false, reflecting that Prisma returns objects, not field-ordered arrays.

Source

Thrown at drizzle-orm/src/prisma/pg/session.ts:34

export class PrismaPgPreparedQuery<T> extends PgPreparedQuery<PreparedQueryConfig & { execute: T }> {
	static override readonly [entityKind]: string = 'PrismaPgPreparedQuery';

	constructor(
		private readonly prisma: PrismaClient,
		query: Query,
		private readonly logger: Logger,
	) {
		super(query, undefined, undefined, undefined);
	}

	override execute(placeholderValues?: Record<string, unknown>): Promise<T> {
		const params = fillPlaceholders(this.query.params, placeholderValues ?? {});
		this.logger.logQuery(this.query.sql, params);
		return this.prisma.$queryRawUnsafe(this.query.sql, ...params);
	}

	override all(): Promise<unknown> {
		throw new Error('Method not implemented.');
	}

	override isResponseInArrayMode(): boolean {
		return false;
	}
}

export interface PrismaPgSessionOptions {
	logger?: Logger;
}

export class PrismaPgSession extends PgSession {
	static override readonly [entityKind]: string = 'PrismaPgSession';

	private readonly logger: Logger;

	constructor(
		dialect: PgDialect,

View on GitHub (pinned to b7862528fd)

Solutions

  1. Use execute() (db.select()/db.execute()) which is the implemented path through $queryRawUnsafe.
  2. Use a native Drizzle PostgreSQL driver (postgres-js, node-postgres) for migrations and any path needing all().
  3. Avoid session-level all() calls in application code; prefer the query builder.

Example fix

// before (throws)
await preparedQuery.all();

// after
await preparedQuery.execute();
Defensive patterns

Strategy: validation

Validate before calling

import { entityKind } from 'drizzle-orm/entity';

function isPrismaPgPrepared(q: any): boolean {
  return q?.[entityKind] === 'PrismaPgPreparedQuery';
}

const rows = isPrismaPgPrepared(stmt) ? await stmt.execute() : await stmt.all();

Type guard

function isPrismaPgPreparedQuery(q: unknown): boolean {
  return (q as any)?.[Symbol.for('drizzle:entityKind')] === 'PrismaPgPreparedQuery';
}

Try / catch

try {
  await preparedQuery.all();
} catch (e) {
  if (e instanceof Error && e.message === 'Method not implemented.') {
    await preparedQuery.execute();
  } else throw e;
}

Prevention

When it happens

Trigger: Calling preparedQuery.all() directly, or hitting an internal Drizzle code path that selects all() on a PrismaPgPreparedQuery. Some migrate/ introspection helpers and certain dialect-specific code paths invoke all().

Common situations: Running migrations or CLI tooling against a Prisma-backed PostgreSQL Drizzle instance. Custom code calling the prepared query's all() method.

Related errors


AI-assisted analysis of drizzle-team/drizzle-orm@b7862528fd (2026-08-03). Data as JSON: /data/errors/7e9d65108653fc86.json. Report an issue: GitHub.