{"action":"opened","issue":{"url":"https://api.github.com/repos/envms/fluentpdo/issues/179","repository_url":"https://api.github.com/repos/envms/fluentpdo","labels_url":"https://api.github.com/repos/envms/fluentpdo/issues/179/labels{/name}","comments_url":"https://api.github.com/repos/envms/fluentpdo/issues/179/comments","events_url":"https://api.github.com/repos/envms/fluentpdo/issues/179/events","html_url":"https://github.com/envms/fluentpdo/issues/179","id":173762326,"number":179,"title":"Regex in WHERE-clause triggers smart join","user":{"login":"afk","id":120251,"avatar_url":"https://avatars.githubusercontent.com/u/120251?v=3","gravatar_id":"","url":"https://api.github.com/users/afk","html_url":"https://github.com/afk","followers_url":"https://api.github.com/users/afk/followers","following_url":"https://api.github.com/users/afk/following{/other_user}","gists_url":"https://api.github.com/users/afk/gists{/gist_id}","starred_url":"https://api.github.com/users/afk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/afk/subscriptions","organizations_url":"https://api.github.com/users/afk/orgs","repos_url":"https://api.github.com/users/afk/repos","events_url":"https://api.github.com/users/afk/events{/privacy}","received_events_url":"https://api.github.com/users/afk/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-08-29T12:24:07Z","updated_at":"2016-08-29T12:24:07Z","closed_at":null,"body":"## Reproduction:\r\n```php\r\n$fpdo->from('table')\r\n     ->select(null)\r\n     ->select('id')\r\n     ->where('nummer REGEXP \\'[[:alpha:]]$\\'')\r\n     ->fetchAll();\r\n```\r\ngenerates\r\n```sql\r\nSELECT id\r\nFROM gebaude\r\n    LEFT JOIN alpha ON alpha.gebaude_id = gebaude.id\r\nWHERE nummer REGEXP '[[:alpha:]]$'\r\n```\r\n\r\n## Current workaround: \r\nUsing `disableSmartJoin()`\r\n```php\r\n$fpdo->from('table')\r\n     ->disableSmartJoin()\r\n     ->select(null)\r\n     ->select('id')\r\n     ->where('nummer REGEXP \\'[[:alpha:]]$\\'')\r\n     ->fetchAll();\r\n```\r\ngenerates\r\n```sql\r\nSELECT id\r\nFROM gebaude\r\nWHERE nummer REGEXP '[[:alpha:]]$'\r\n```\r\n\r\n## Further information:\r\nError seems to emerge in [CommonQuery->buildQuery()](https://github.com/envms/fluentpdo/blob/master/FluentPDO/CommonQuery.php#L244-L254) where [createUndefinedJoins](https://github.com/envms/fluentpdo/blob/master/FluentPDO/CommonQuery.php#L263-L286) is [called](https://github.com/envms/fluentpdo/blob/master/FluentPDO/CommonQuery.php#L249)."}}
{"actor":{"display_login":"afk"}}