Skip to content

[BUG]: onConflictDoUpdate error in casing #675

@vf-unordinary

Description

@vf-unordinary

What version of drizzle-orm are you using?

0.26.3

What version of drizzle-kit are you using?

0.18.1

Describe the Bug

Hey all!

I've found a funny problem while using drizzle + postgres (Vercel postgres).

Having this schema:

export const Processings = pgTable('processings', {
    id: serial('id').primaryKey(),
    name: text('name').notNull(),
    estimateHours: integer('estimateHours').notNull(),
    processDefinitionId: integer('processDefinitionId').references(() => ProcessDefinitions.id)
});

When trying to upsert a new Processing using

await db
  .insert(Processings)
  .values(form.data.processings)
  .onConflictDoUpdate({
    target: Processings.id,
    set: {
      name: sql`excluded.name`,
      processDefinitionId: sql`excluded.processDefinitionId`,
      estimateHours: sql`excluded.estimateHours`,
    },
  });

The query returns this error:

error: column excluded.processdefinitionid does not exist

and further in the error:

hint: 'Perhaps you meant to reference the column "excluded.processDefinitionId".'

The difference is in the casing of processDefinitionId.
I'm on typescript so I'm using intellisense suggestions.

Expected behavior

No response

Environment & setup

I'm using sveltekit right now
Vercel Postgres
Typescript

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions