-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed as duplicate of#4060
Labels
bugSomething isn't workingSomething isn't working
Description
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.3
What version of drizzle-kit are you using?
0.30.4
Other packages
drizzle-seed 0.3.0
Describe the Bug
When querying a table that does not have an underscore in the table name eg: "users" the query will fail with an error.
Schema:
export const exampleSchema = pgSchema("example");
export const users = exampleSchema.table("users", {
id: bigint({ mode: "number" }).primaryKey().generatedAlwaysAsIdentity(),
firstName: varchar("user_name", { length: 25 }),
});Query:
const db = drizzle(process.env.DATABASE_URL!, {
schema: { users, posts, comments },
casing: "snake_case",
});
const main = async () => {
const result = await db.query.users.findFirst();
console.log(result);
};
main();Results in error:
error: relation "users" does not exist
at /Users/rgessler/fo-drizzle-my-nizzle/node_modules/pg-pool/index.js:45:11
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at <anonymous> (/Users/rgessler/fo-drizzle-my-nizzle/node_modules/src/node-postgres/session.ts:104:19)
at main (/Users/rgessler/fo-drizzle-my-nizzle/src/index.ts:5:18) {
length: 104,
severity: 'ERROR',
code: '42P01',
detail: undefined,
hint: undefined,
position: '31',
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: 'parse_relation.c',
line: '1449',
routine: 'parserOpenTable'
}However
Changing the table name in the schema from "users" to "users_" results in a successful query return. It also seems that this bug started in version 0.39.1 as I've reverted to 0.39.0 as a temporary solution.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working