{"action":"created","issue":{"url":"https://api.github.com/repos/coleifer/peewee/issues/187","labels_url":"https://api.github.com/repos/coleifer/peewee/issues/187/labels{/name}","comments_url":"https://api.github.com/repos/coleifer/peewee/issues/187/comments","events_url":"https://api.github.com/repos/coleifer/peewee/issues/187/events","html_url":"https://github.com/coleifer/peewee/issues/187","id":13858977,"number":187,"title":"Unexpected LIKE operations","user":{"login":"dmwyatt","id":163359,"avatar_url":"https://avatars.githubusercontent.com/u/163359?v=3","gravatar_id":"","url":"https://api.github.com/users/dmwyatt","html_url":"https://github.com/dmwyatt","followers_url":"https://api.github.com/users/dmwyatt/followers","following_url":"https://api.github.com/users/dmwyatt/following{/other_user}","gists_url":"https://api.github.com/users/dmwyatt/gists{/gist_id}","starred_url":"https://api.github.com/users/dmwyatt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmwyatt/subscriptions","organizations_url":"https://api.github.com/users/dmwyatt/orgs","repos_url":"https://api.github.com/users/dmwyatt/repos","events_url":"https://api.github.com/users/dmwyatt/events{/privacy}","received_events_url":"https://api.github.com/users/dmwyatt/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2013-05-01T18:10:20Z","updated_at":"2016-01-01T22:15:38Z","closed_at":"2013-05-02T02:56:59Z","body":"The following LIKE query gets me nothing:\r\n\r\n    In [22]: movies =models.Movie.select().where(models.Movie.name % '%I%')         \r\n    \r\n    In [23]: for m in movies:\r\n       ....:     print m\r\n       ....:     \r\n\r\nUsing ILIKE works:\r\n\r\n    In [26]: movies =models.Movie.select().where(models.Movie.name ** '%i%')        \r\n    \r\n    In [27]: for m in movies:                                               \r\n        print m\r\n       ....:     \r\n    <Movie: 'Iron Man'>\r\n    <Movie: 'Wreck-It Ralph'>\r\n\r\n\r\n\r\nUsing the command line sqlite3 tool:\r\n\r\n    sqlite> SELECT * FROM movie WHERE name LIKE '%I%';                              \r\n    1|Iron Man\r\n    2|Wreck-It Ralph\r\n    sqlite> \r\n\r\nThis is more likely my idiocy than a bug in peewee, but I can't see where I'm going wrong.  \r\n\r\nI just pip installed peewee a couple hours ago, so I'm using whatever version is most recent."},"comment":{"url":"https://api.github.com/repos/coleifer/peewee/issues/comments/168341078","html_url":"https://github.com/coleifer/peewee/issues/187#issuecomment-168341078","issue_url":"https://api.github.com/repos/coleifer/peewee/issues/187","id":168341078,"user":{"login":"benhoyt","id":999033,"avatar_url":"https://avatars.githubusercontent.com/u/999033?v=3","gravatar_id":"","url":"https://api.github.com/users/benhoyt","html_url":"https://github.com/benhoyt","followers_url":"https://api.github.com/users/benhoyt/followers","following_url":"https://api.github.com/users/benhoyt/following{/other_user}","gists_url":"https://api.github.com/users/benhoyt/gists{/gist_id}","starred_url":"https://api.github.com/users/benhoyt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benhoyt/subscriptions","organizations_url":"https://api.github.com/users/benhoyt/orgs","repos_url":"https://api.github.com/users/benhoyt/repos","events_url":"https://api.github.com/users/benhoyt/events{/privacy}","received_events_url":"https://api.github.com/users/benhoyt/received_events","type":"User","site_admin":false},"created_at":"2016-01-01T22:15:38Z","updated_at":"2016-01-01T22:15:38Z","body":"This behavior got me too (before I looked at the output, noticed it was using GLOB with SQLite, then saw the note in the docs). It seems quite surprising, and would mean if you change your code to use `field % 'whatever*'` to work with SQLite, then if you switch to PostgreSQL it'll break.\r\n\r\nI think it'd be more cross-database compatible and less surprising if the `%` operator on SQLite changed the `%`'s in your match string to `*` as well as using `GLOB`, so you didn't have to worry about which database you were on. Thoughts?"}}