Skip to content

[BUG]: Case preference not honored in column name #5282

@muezz

Description

@muezz

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.44.7

What version of drizzle-kit are you using?

0.31.5

Other packages

No response

Describe the Bug

        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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions