Report hasn't been filed before.
What version of drizzle-orm are you using?
0.44.0
What version of drizzle-kit are you using?
n/a
Other packages
No response
Describe the Bug
This query is unable to find "caretakerName" and instead generates an SQL query with "undefined".
import { drizzle } from "drizzle-orm/node-postgres";
import { pgTable, pgView } from "drizzle-orm/pg-core";
import { eq } from "drizzle-orm";
const animal = pgTable("animal", (t) => ({
id: t.text().primaryKey(),
name: t.text().notNull(),
caretakerId: t.text().notNull(),
}));
const caretaker = pgTable("caretaker", (t) => ({
id: t.text().primaryKey(),
caretakerName: t.text().notNull(),
}));
const animalWithCaretakerView = pgView("animal_with_caretaker_view").as(
(qb) =>
qb
.select({
id: animal.id,
animalName: animal.name,
caretakerName: caretaker.caretakerName,
})
.from(animal)
.innerJoin(caretaker, eq(animal.caretakerId, caretaker.id)),
);
const schema = { animal, caretaker, animalWithCaretakerView };
const db = drizzle("", {schema})
console.log(db.select().from(animalWithCaretakerView).toSQL().sql)
// select "id", "name", "undefined" from "animal_with_caretaker_view"
Report hasn't been filed before.
What version of
drizzle-ormare you using?0.44.0
What version of
drizzle-kitare you using?n/a
Other packages
No response
Describe the Bug
This query is unable to find "caretakerName" and instead generates an SQL query with "undefined".