question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Case-insensitive filtering does not work

See original GitHub issue

Bug description

Case-insensitive filtering doesn’t work. Intellisense isn’t picking up any properties named ‘mode’ anywhere in the options for where. Error thrown is “Unknown arg ‘mode’”

How to reproduce

Enable the preview feature in schema.prisma and add mode: ‘insensitive’ to the query.

return await db.user.findMany({
  where: {
    name: { contains: userName, mode: 'insensitive' }, // throws error
    // also fails inside of OR
    OR: [
      {
        name: { contains: userQuery, mode: 'insensitive' }, // throws error
      },
      {
        email: { contains: userQuery },
      },
    ],
  },
  select: { email: true, id: true, name: true },
})

Expected behavior

Case-insensitive filtering should work.

Prisma information

It’s the latest version. I’ve enabled the preview feature in schema.prisma.

Environment & setup

  • OS: macOS
  • Database: PostgreSQL 13
  • Node.js version: 14.10
  • Prisma version: 2.7.1
@prisma/cli          : 2.7.1
Current platform     : darwin
Query Engine         : query-engine 5c2ad460cf4fe8c9330e6640b266c046542c8b6a (at node_modules/@prisma/cli/query-engine-darwin)
Migration Engine     : migration-engine-cli 5c2ad460cf4fe8c9330e6640b266c046542c8b6a (at node_modules/@prisma/cli/migration-engine-darwin)
Introspection Engine : introspection-core 5c2ad460cf4fe8c9330e6640b266c046542c8b6a (at node_modules/@prisma/cli/introspection-engine-darwin)
Format Binary        : prisma-fmt 5c2ad460cf4fe8c9330e6640b266c046542c8b6a (at node_modules/@prisma/cli/prisma-fmt-darwin)
Studio               : 0.288.0

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
aaronfulkersoncommented, Sep 30, 2020

I figured out what was going on. For some reason the datasource provider contained both sqlite and postgres. Removing sqlite so that just postgres remained solved the problem.

1reaction
aaronfulkersoncommented, Sep 30, 2020

I filed this bug before 2.8.0 was released and took that screenshot on 2.7.1 with the feature flag enabled. Though I did upgrade to 2.8.0 and remove the previewFeature flag, the error remains.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ES6: Filter data with case insensitive term - javascript
This is how I filter some data ...
Read more >
Case insensitive filter - Get Help - Metabase Discussion
If I run the raw SQL from Metabase, it produces the correct (case-insensitive) result. Any idea what could be going wrong here?
Read more >
Case Insensitive Filtering Using Power Query - MyExcelOnline
Case Insensitive Filtering Using Power Query - Learn an easy way to do case insensitive filtering in Power Query with just a few...
Read more >
Substring with case Insensitive filter is not working OData V4
Working on the filter options through ODataV4 endpoints. In the API I have a field name called Description and it has the value....
Read more >
Need filter case insensitive - Appian Community
If your collation is case sensitive (and you can't change it to case insensitive), you might have to do a workaround like create...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found