(no error) search or login finds nothing: WHERE email LIKE ... returns 0 rows

Laravel app, just moved from MySQL to PostgreSQL. No exception, just missing results.

(no error) search or login finds nothing: WHERE email LIKE ... returns 0 rows

Why it happens

Not an error, which makes it worse. MySQL's _ci collations make = and LIKE case-insensitive. Postgres is case-sensitive, so Name@Example.com no longer matches name@example.com.

Fix

WHERE email ILIKE 'a@%' WHERE lower(email) = lower(?) -- or the citext extension for email columns

Tested on Postgres 17.11. Also check unique indexes: two rows differing only in case were blocked on MySQL and are allowed on Postgres.

More fixes like this one, as tested scripts: Laravel Postgres Error Fix Pack ($19).

Several errors at once? Paste your log into the error matcher. Raw SQL with MySQL syntax: the free SQL translator. Not migrated yet: the free schema risk check finds this kind of problem before the switch. Planning the whole move: Migration Kit ($49, $34.30 with LAUNCH30 until Nov 5).

Other errors after MySQL to Postgres

Published with deed.page