Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested disconnect fails with extendedWhereUnique on SQL #16843

Closed
Weakky opened this issue Dec 15, 2022 · 1 comment · Fixed by prisma/prisma-engines#3514
Closed

Nested disconnect fails with extendedWhereUnique on SQL #16843

Weakky opened this issue Dec 15, 2022 · 1 comment · Fixed by prisma/prisma-engines#3514
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug. team/client Issue for team Client. tech/engines Issue for tech Engines. topic: extendedWhereUnique Preview Feature
Milestone

Comments

@Weakky
Copy link
Member

Weakky commented Dec 15, 2022

Bug description

Consider this datamodel

model Parent {
  id Int @id

  childId Int? @unique
  childOpt Child? @relation(fields: [childId], references: [id])
}

model Child {
  id Int @id
  non_unique String
  parentOpt Parent?
}

And say you run this query

await prisma.parent.update({
  where: { id: 1 },
  data: {
    childOpt: { disconnect: { non_unique: 1 } }
  }
})

The query will fail on the UPDATE statement because it's lacking a join to check Child.non_unique.

Expected behavior

The query should work regardless of where the relation is inlined.

Environment & setup

  • OS: macOS
  • Database: Postgres 10

Prisma Version

4.7.0
@Weakky Weakky added bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug. tech/engines Issue for tech Engines. topic: extendedWhereUnique Preview Feature labels Dec 15, 2022
@janpio janpio added the team/client Issue for team Client. label Dec 15, 2022
@Weakky Weakky changed the title Nested disconnect fails with extendedWhereUnique Nested disconnect fails with extendedWhereUnique on SQL Dec 16, 2022
@Weakky
Copy link
Member Author

Weakky commented Dec 16, 2022

Related to #15837

@janpio janpio added this to the 4.8.0 milestone Dec 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug. team/client Issue for team Client. tech/engines Issue for tech Engines. topic: extendedWhereUnique Preview Feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants