drizzle-team / drizzle-orm

Headless TypeScript ORM with a head. Runs on Node, Bun and Deno. Lives on the Edge and yes, it's a JavaScript ORM too 😅
https://orm.drizzle.team
Apache License 2.0
23.59k stars 579 forks source link

[BUG]: DatabaseErrorException: ERROR: operator does not exist: uuid = text; Hint: No operator matches the given name and argument types. You might need to add explicit type casts.; Position: 54; SQLState: 42883 #2583

Open trevorpfiz opened 3 months ago

trevorpfiz commented 3 months ago

What version of drizzle-orm are you using?

0.31.2

What version of drizzle-kit are you using?

0.22.8

Describe the Bug

When I use driver: "aws-data-api" with an RDS database I can't update or delete in the studio without this error: [BUG]: DatabaseErrorException: ERROR: operator does not exist: uuid = text; Hint: No operator matches the given name and argument types. You might need to add explicit type casts.; Position: 54; SQLState: 42883

Following this https://ion.sst.dev/docs/start/aws/drizzle/.

Cross-posting this to drizzle-orm from https://github.com/drizzle-team/drizzle-kit-mirror/issues/421

Expected behavior

I would expect to be able to update and delete from the studio like when using other databases.

Environment & setup

I have only tested development with sst shell drizzle-kit studio.

Morphexe commented 3 months ago

It seems this also happens when using enums in my case:

Error: ERROR: operator does not exist: agent_task = text; Hint: No operator matches the given name and argument types. You might need to add explicit type casts.; Position: 1879; SQLState: 42883

telgueta commented 1 month ago

any way to solve this? the same is happening to me. It started happening when i change my serial primary key to uuid type:

export const SHIPMENTS = EDI_SCHEMA.table(
  "shipments",
  {
    id: uuid("id").primaryKey().defaultRandom(),
    bookingNumber: text("bookingNumber").notNull(),
    billOfLading: text("billOfLading").unique(),
    company: text("company").notNull(),
    pol: text("pol").notNull(),
    pod: text("pod").notNull(),
    finalPod: text("finalPod"),
    carrier: text("carrier").notNull(),
    createdAt: timestamp("createdAt"),
    updatedAt: timestamp("updatedAt"),
  },
  (t) => ({
    bl_company: unique("bl_company")
      .on(t.billOfLading, t.company)
      .nullsNotDistinct(),
  })
);