{"action":"opened","issue":{"url":"https://api.github.com/repos/cakephp/cakephp/issues/8272","repository_url":"https://api.github.com/repos/cakephp/cakephp","labels_url":"https://api.github.com/repos/cakephp/cakephp/issues/8272/labels{/name}","comments_url":"https://api.github.com/repos/cakephp/cakephp/issues/8272/comments","events_url":"https://api.github.com/repos/cakephp/cakephp/issues/8272/events","html_url":"https://github.com/cakephp/cakephp/issues/8272","id":134087737,"number":8272,"title":"ORM\\QueryTest::testNotMatchingNested fails on posgres 9.4","user":{"login":"skie","id":130799,"avatar_url":"https://avatars.githubusercontent.com/u/130799?v=3","gravatar_id":"","url":"https://api.github.com/users/skie","html_url":"https://github.com/skie","followers_url":"https://api.github.com/users/skie/followers","following_url":"https://api.github.com/users/skie/following{/other_user}","gists_url":"https://api.github.com/users/skie/gists{/gist_id}","starred_url":"https://api.github.com/users/skie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skie/subscriptions","organizations_url":"https://api.github.com/users/skie/orgs","repos_url":"https://api.github.com/users/skie/repos","events_url":"https://api.github.com/users/skie/events{/privacy}","received_events_url":"https://api.github.com/users/skie/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-02-16T20:23:50Z","updated_at":"2016-02-16T20:23:50Z","closed_at":null,"body":"Test case **ORM\\QueryTest::testNotMatchingNested** is getting sql that considered as invalid at least for two databases: **postgres 9.4**, and **oracle 11g**.\r\n\r\nGenerated by test query looks like:\r\n\r\n```sql\r\nSELECT authors.id         AS authors__id,\r\n       authors.name       AS authors__name,\r\n       articles.id        AS articles__id,\r\n       articles.author_id AS articles__author_id,\r\n       articles.title     AS articles__title,\r\n       articles.body      AS articles__body,\r\n       articles.published AS articles__published\r\n  FROM authors authors\r\n  LEFT JOIN articles articles\r\n    ON (tags.name = :c0 AND authors.id = (articles.author_id))\r\n  LEFT JOIN tags tags\r\n    ON tags.name = :c1\r\n  LEFT JOIN articles_tags ArticlesTags\r\n    ON (articles.id = (ArticlesTags.article_id) AND\r\n       tags.id = (ArticlesTags.tag_id))\r\n WHERE (((ArticlesTags.article_id) IS NULL AND\r\n       (ArticlesTags.tag_id) IS NULL) AND ((ArticlesTags.article_id) IS NULL AND\r\n       (ArticlesTags.tag_id) IS NULL))\r\n ORDER BY authors.id ASC, articles.id ASC LIMIT 1\r\n```\r\n\r\nProblem located in ON clause for first join with articles.  tags table is not declared for this moment so more strict query analyzers are failing on such sort of query.\r\n\r\n```sql\r\n  LEFT JOIN articles articles\r\n    ON (tags.name = :c0 AND authors.id = (articles.author_id))\r\n```\r\n"}}