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

Can't filter by null values on JSONB fields #8399

Closed
Tracked by #8628
benedyktdryl opened this issue Jul 22, 2021 · 0 comments · Fixed by #9074
Closed
Tracked by #8628

Can't filter by null values on JSONB fields #8399

benedyktdryl opened this issue Jul 22, 2021 · 0 comments · Fixed by #9074
Assignees
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug. team/client Issue for team Client. topic: filterJson topic: where / filter

Comments

@benedyktdryl
Copy link

benedyktdryl commented Jul 22, 2021

Bug description

Can't filter by null values on JSONB fields

How to reproduce

  1. Run query with null value filter
prisma.model.findMany({
  where: {
    NOT: {
      data: {
        path: ["foo"],
        equals: null,
      },
    },
  },
});
  1. See error:

Argument equals for where.NOT.0.data.equals must not be null. Please use undefined instead.

Expected behavior

As JSONB values are allowed, I should be able to find values filtered by null.

Prisma information

model model {
  id               String            @id @db.Uuid
  data             Json
}

Environment & setup

  • OS: MacOS
  • Database: PostgreSQL
  • Node.js version: 14.x

Prisma Version

`"@prisma/client": "^2.20.1"`
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. topic: filterJson topic: where / filter
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants