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 insesitive query throws server error.

See original GitHub issue

when running a case insensitive query the the following error is thrown:

Invalid `
prisma.make.findMany()` invocation:
{
 where: {
    name: {
      equals: 'BMW',
      mode: 'insensitive'
        }
          ~~~~~~~~~~~~~~~~~~~~~
      }
    }
      
      Argument name: Got invalid value 
      {
          equals: 'BMW',
        mode: 'insensitive'
    }
      on prisma.findManyMake. Provided Json, expected StringNullableFilter or String or Null.
      
      

To Reproduce

Runn the following query

query {
  allMakes(where: { name_i: "BMW" }) {
    name
    models {
      name
    }
  }
}

this also happens in code:

   const res = await models.Make.findMany({
            where: { name_i: make }
          });

Expected behaviour

Return results

Screenshots

image

System information

  • Keystone: @keystone-next/keystone": "^14.0.1",

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
timlesliecommented, Apr 8, 2021

@ashhitch Ah, I’ve just found the issue. The SQLite adapter does not support case insensitive search, due to limitations in SQLite itself. The name_i filter option should be disabled when running on SQLite (e.g. it shouldn’t exist in the schema at all)… I just found a bug in the code which is stopping this disable step from working, which is why you’re seeing it in your schema. I’m going to ship a fix for this in the next release 👍

0reactions
timlesliecommented, Apr 8, 2021

No worries. Good to hear that you’re going to do the SQLite -> PostgreSQL upgrade, that’s the graduation path that we’d expect most developers to take. SQLite is great for day 1 hacking, but the limitations make it worth making the step up to PostgreSQL worth it 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Collation at server level is causing issues with case sensitivity ...
The issue I am running into now is that all variables in stored procedures must be case sensitive or else it will throw...
Read more >
Error messages encountered due to case sensitive collation of ...
These error messages occurred after migrating a database to a SQL Server with a case-sensitive collation. The project database requires a ...
Read more >
Case Insensitive Queries - Ask TOM
Is there a way to SELECT from a table in a case insensitive manner? For example, I want to execute: SELECT * FROM...
Read more >
Case-insensitive pattern matching in PostgreSQL - CYBERTEC
We discuss the options for case-insensitive comparison and pattern matching in PostgreSQL, comparing the performance of different ...
Read more >
SQL SERVER - Case Sensitive Database and Database User
SQL SERVER – Case Sensitive Database and Database User – Fix: Error: 15151 – Cannot find the user , because it does not...
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