2 years ago

Weird Eloquent results on 'exact match' db queries

Posted 2 years ago by EventFellows

I have a strange problem and no idea where to start debugging it.

I have a normal users table that also contains a UUID column with automatically generated uuids like 8489fd5e-026a-43a0-b8aa-b2dc9ceb4b95 or 563e3b44-7f66-4ba7-b9e0-71bdeab19468 for example (some of the UUIDs start with a number).

I run a simple query like

        $users = User::where('uuid', '=', 5)->get();

The expected result would be that there are no results because but the query does return a seemingly random subset of all the users where the UUID starts with the number 5.

mysql is in strict mode and the DB query that is run is

SELECT * FROM `users` WHERE `uuid` = '5' and `users`.`deleted_at` IS NULL

L5.3 on PHP 7

Does anyone have an idea where and how to look into that?

Please sign in or create an account to participate in this conversation.