drizzle-team / drizzle-team/drizzle-orm

[BUG]: Case preference not honored in column name

Open
#5,282 5 comments 0 reactions 0 assignees View on GitHub
bug bug/fixed-in-beta
Dominant language
TypeScript
Stars
35.8k
Forks
1.6k
Avg merge
2d 7h
Merged PRs (30d)
4

Description

### Report hasn't been filed before.

- [x] 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.44.7

### What version of `drizzle-kit` are you using?

0.31.5

### Other packages

_No response_

### Describe the Bug

```ts
await db
.insert(payments)
.values({
id: pId,
idInvoice: props.invoiceId,
idUser: props.userId,
amount: props.amount,
completedAt: new Date(),
status: "paid",
metadata: paymentMetadata,
remarks: props.remarks,
})
.onConflictDoUpdate({
target: [payments.id, payments.idInvoice],
set: {
status: sql.raw(`excluded.${payments.status.name}`),
completedAt: sql.raw(`excluded.${payments.completedAt.name}`),
metadata: sql.raw(`excluded.${payments.metadata.name}`),
remarks: sql.raw(`excluded.${payments.remarks.name}`),
amount: sql.raw(`excluded.${payments.amount.name}`),
},
});
```

In the above query, we get an error that says `column excluded.completedat does not exist`. In the drizzle config, we have set the casing preference to be snake_case so the expectation is that the name should get resolved to `excluded.completed_at` by `sql.raw()`.

There is no mention of this behavior in the docs.

For context, the project is a monorepo with typescript and uses Postgres with Neon under the hood.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.