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?
N?A
Other packages
No response
Describe the Bug
import {drizzle} from 'drizzle-orm/postgres-js'
const db = drizzle('postgres://...', {logger: true})
const t1 = pgTable('table', (t) => ({
id: t.text().primaryKey(),
}))
console.log(
t1.id.name,
db.insert(t1).values({id: '1'}).toSQL(),
)
// id { sql: 'insert into "table" ("id") values ($1)', params: [ '1' ] }
const t2 = pgTable('table', (t) => ({
id: t.text().primaryKey(),
name: t.text(),
}))
const query = db.insert(t2).values({id: '1', name: 'test'}).toSQL()
console.log(t2.name.name, query)
// {
// sql: 'insert into "table" ("id", "undefined") values ($1, $2)',
// params: [ '1', 'test' ]
// }
See the repro step above. It appears that drizzle is unexpectedly caching columns based on table names, and that breaks when you construct tables dynamically
Upon some digging, I believe this is due to the unfortunate CasingCache
Report hasn't been filed before.
What version of
drizzle-ormare you using?0.39.1
What version of
drizzle-kitare you using?N?A
Other packages
No response
Describe the Bug
See the repro step above. It appears that drizzle is unexpectedly caching columns based on table names, and that breaks when you construct tables dynamically
Upon some digging, I believe this is due to the unfortunate
CasingCache