Skip to content

[BUG]: DrizzleQueries are failing because of missing schema name (Postgres) #4060

@maxdollinger

Description

@maxdollinger

Report hasn't been filed before.

  • I have verified that the bug I'm about to report hasn't been filed before.

What version of drizzle-orm are you using?

0.39.1

What version of drizzle-kit are you using?

0.30.4

Other packages

No response

Describe the Bug

We use pgSchema for our table definitions like:
export const user = pgSchema('app_one').table('user', { id: integer('id').generatedAlwaysAsIdentity().primaryKey(), name: text('name'), })

When making a query like db.query.user.findMany() the produced sql code looks like this select "id", "name" from "user" which fails because the schema is missing. It should be select "id", "name" from "app_one"."user"

When using the query builder like db.select().from(user) the produced sql is correct select "id", "name" from "app_one"."user"

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions