jeremyevans/sequel — Issue #427: Generating impossible queries
Author: xaviershay
Created: 2012-01-27 19:39:09+00:00
State: open

Hi Jeremy,
Is there any reason why the following filter can't just emit "false"?

```
> db[:a].filter(:b => []).sql
=> "SELECT * FROM `a` WHERE (`b` != `b`)"
```

I ask because the MySQL query planner is stupid:

```
> select count(*) from a
6676042
> delete from a where b != b;
Query OK, 0 rows affected (4.37 sec)
> delete from a where false;
Query OK, 0 rows affected (0.00 sec)
```

I can look at making a patch, just wanted to get your immediate impression since it seems like `b != b` may have been chosen deliberately.