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.

Possible bug in Querying operators: `$iLike` triggering error when `$like` works.

See original GitHub issue

I’ve the following code:

query.where[param].$iLike = '%' + options.req.query.filter[param] + '%';

to make a dynamic searching, but is triggering the following error:

error: { [SequelizeDatabaseError: SQLITE_ERROR: near "ILIKE": syntax error]
  name: 'SequelizeDatabaseError',
  message: 'SQLITE_ERROR: near "ILIKE": syntax error',
  parent: 
   { [Error: SQLITE_ERROR: near "ILIKE": syntax error]
     errno: 1,
     code: 'SQLITE_ERROR',
     sql: 'SELECT `id`, `name`, `legal_name`, `color`, `logo`, `full_logo`, `banner`, `notes`, `created_at`, `updated_at`, `deleted_at`, `hierarchy_level`, `parent_id` FROM `Organizations` AS `Organization` WHERE (`Organization`.`deleted_at` IS NULL AND `Organization`.`name` ILIKE \'%x%\') LIMIT 10;' },
  original: 
   { [Error: SQLITE_ERROR: near "ILIKE": syntax error]
     errno: 1,
     code: 'SQLITE_ERROR',
     sql: 'SELECT `id`, `name`, `legal_name`, `color`, `logo`, `full_logo`, `banner`, `notes`, `created_at`, `updated_at`, `deleted_at`, `hierarchy_level`, `parent_id` FROM `Organizations` AS `Organization` WHERE (`Organization`.`deleted_at` IS NULL AND `Organization`.`name` ILIKE \'%x%\') LIMIT 10;' },
  sql: 'SELECT `id`, `name`, `legal_name`, `color`, `logo`, `full_logo`, `banner`, `notes`, `created_at`, `updated_at`, `deleted_at`, `hierarchy_level`, `parent_id` FROM `Organizations` AS `Organization` WHERE (`Organization`.`deleted_at` IS NULL AND `Organization`.`name` ILIKE \'%x%\') LIMIT 10;' }

If I change $iLike for $like it works like a charm.

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
janmeiercommented, Aug 24, 2015

And like is case insensitive in sqlite by default 😃 http://sqlite.org/faq.html#q18

1reaction
janmeiercommented, Aug 24, 2015

iLike is only supported by postgres

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to use iLike operator with Sequelize to make case ...
I would like to perform a case insensitive search query. When I googled it up, some people said that I can use "iLike"...
Read more >
Documentation: 11: E.13. Release 11.6 - PostgreSQL
This mistake caused the planner to treat too much of the pattern as being a fixed prefix, so that indexscans derived from an...
Read more >
Update #7002 fails on postgres - ILIKE operator on bytea not ...
I just experienced a similar issue upgrading form 7.01: Failed: PDOException: SQLSTATE[42883]: Undefined function: 7 ERROR: operator does not ...
Read more >
Error and Transaction Handling in SQL Server Part Two
This is a bug in SqlClient which is not able to cope with datetimeoffset data in an sql_variant value. You don't get this...
Read more >
QuerySet API reference | Django documentation
A QuerySet is iterable, and it executes its database query the first time you ... Passing different models works as long as the...
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