{"action":"created","issue":{"url":"https://api.github.com/repos/slick/slick/issues/1316","repository_url":"https://api.github.com/repos/slick/slick","labels_url":"https://api.github.com/repos/slick/slick/issues/1316/labels{/name}","comments_url":"https://api.github.com/repos/slick/slick/issues/1316/comments","events_url":"https://api.github.com/repos/slick/slick/issues/1316/events","html_url":"https://github.com/slick/slick/issues/1316","id":111268952,"number":1316,"title":"Bug with monadic joins","user":{"login":"ErunamoJAZZ","id":421398,"avatar_url":"https://avatars.githubusercontent.com/u/421398?v=3","gravatar_id":"","url":"https://api.github.com/users/ErunamoJAZZ","html_url":"https://github.com/ErunamoJAZZ","followers_url":"https://api.github.com/users/ErunamoJAZZ/followers","following_url":"https://api.github.com/users/ErunamoJAZZ/following{/other_user}","gists_url":"https://api.github.com/users/ErunamoJAZZ/gists{/gist_id}","starred_url":"https://api.github.com/users/ErunamoJAZZ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ErunamoJAZZ/subscriptions","organizations_url":"https://api.github.com/users/ErunamoJAZZ/orgs","repos_url":"https://api.github.com/users/ErunamoJAZZ/repos","events_url":"https://api.github.com/users/ErunamoJAZZ/events{/privacy}","received_events_url":"https://api.github.com/users/ErunamoJAZZ/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/slick/slick/labels/1%20-%20Ready","name":"1 - Ready","color":"c7def8"},{"url":"https://api.github.com/repos/slick/slick/labels/bug","name":"bug","color":"e11d21"},{"url":"https://api.github.com/repos/slick/slick/labels/REGRESSION","name":"REGRESSION","color":"e11d21"},{"url":"https://api.github.com/repos/slick/slick/labels/UPVOTED","name":"UPVOTED","color":"5319e7"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/slick/slick/milestones/22","html_url":"https://github.com/slick/slick/milestones/3.1.x","labels_url":"https://api.github.com/repos/slick/slick/milestones/22/labels","id":1364188,"number":22,"title":"3.1.x","description":"","creator":{"login":"szeiger","id":54262,"avatar_url":"https://avatars.githubusercontent.com/u/54262?v=3","gravatar_id":"","url":"https://api.github.com/users/szeiger","html_url":"https://github.com/szeiger","followers_url":"https://api.github.com/users/szeiger/followers","following_url":"https://api.github.com/users/szeiger/following{/other_user}","gists_url":"https://api.github.com/users/szeiger/gists{/gist_id}","starred_url":"https://api.github.com/users/szeiger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/szeiger/subscriptions","organizations_url":"https://api.github.com/users/szeiger/orgs","repos_url":"https://api.github.com/users/szeiger/repos","events_url":"https://api.github.com/users/szeiger/events{/privacy}","received_events_url":"https://api.github.com/users/szeiger/received_events","type":"User","site_admin":false},"open_issues":3,"closed_issues":16,"state":"open","created_at":"2015-10-19T15:34:37Z","updated_at":"2016-06-29T23:42:54Z","due_on":null,"closed_at":null},"comments":17,"created_at":"2015-10-13T20:54:18Z","updated_at":"2016-09-10T07:34:02Z","closed_at":"2015-10-27T17:21:47Z","body":"Hello!\r\n\r\nI had problems with new slick, because this show me the exception `slick.SlickTreeException: Unreachable reference to s2 after resolving monadic joins` \r\n\r\nSo... i made a little example for explain this: 3 tables, A, B and C, and a table ABC with foreign keys to A, B and C.\r\n\r\n```scala\r\nobject testWithJoins {\r\n\r\n  //TABLE A\r\n  case class a(id:Option[Int],name:String)\r\n  class A_Table(_tableTag: Tag) extends Table[a](_tableTag, \"A\") {\r\n    def * = (id.?, name) <>(a.tupled, a.unapply)\r\n    val id: Rep[Int] = column[Int](\"ID\", O.AutoInc, O.PrimaryKey)\r\n    val name: Rep[String] = column[String](\"NAME\", O.Length(254, varying = true))\r\n  }\r\n  val a_query = new TableQuery(tag => new A_Table(tag))\r\n\r\n  //TABLE B\r\n  case class b(id:Option[Int],name:String)\r\n  class B_Table(_tableTag: Tag) extends Table[b](_tableTag, \"B\") {\r\n    def * = (id.?, name) <>(b.tupled, b.unapply)\r\n    val id: Rep[Int] = column[Int](\"ID\", O.AutoInc, O.PrimaryKey)\r\n    val name: Rep[String] = column[String](\"NAME\", O.Length(254, varying = true))\r\n  }\r\n  val b_query = new TableQuery(tag => new B_Table(tag))\r\n\r\n  //TABLE C\r\n  case class c(id:Option[Int],name:String)\r\n  class C_Table(_tableTag: Tag) extends Table[c](_tableTag, \"C\") {\r\n    def * = (id.?, name) <>(c.tupled, c.unapply)\r\n    val id: Rep[Int] = column[Int](\"ID\", O.AutoInc, O.PrimaryKey)\r\n    val name: Rep[String] = column[String](\"NAME\", O.Length(254, varying = true))\r\n  }\r\n  val c_query = new TableQuery(tag => new C_Table(tag))\r\n\r\n\r\n  //TABLE ABC\r\n  case class abc(id:Option[Int],id_a:Int,id_b:Int,id_c:Int)\r\n  class ABC_Table(_tableTag: Tag) extends Table[abc](_tableTag, \"ABC\") {\r\n    def * = (id.?, id_a, id_b, id_c) <> (abc.tupled, abc.unapply)\r\n\r\n    val id: Rep[Int] = column[Int](\"ID\", O.AutoInc, O.PrimaryKey)\r\n    val id_a: Rep[Int] = column[Int](\"ID_A\")\r\n    val id_b: Rep[Int] = column[Int](\"ID_B\")\r\n    val id_c: Rep[Int] = column[Int](\"ID_C\")\r\n\r\n    lazy val a_Fk = foreignKey(\"a_fk\", id_a, a_query)(r => r.id, onUpdate = ForeignKeyAction.Cascade, onDelete = ForeignKeyAction.NoAction)\r\n    lazy val b_Fk = foreignKey(\"b_fk\", id_b, b_query)(r => r.id, onUpdate = ForeignKeyAction.Cascade, onDelete = ForeignKeyAction.NoAction)\r\n    lazy val c_Fk = foreignKey(\"c_fk\", id_c, c_query)(r => r.id, onUpdate = ForeignKeyAction.Cascade, onDelete = ForeignKeyAction.NoAction)\r\n  }\r\n  val abc_query = new TableQuery(tag => new ABC_Table(tag))\r\n\r\n\r\n  /*\r\n  test 1 fails with Slick 3.1.0\r\n   */\r\n  def test1 = {\r\n    val q1 = for {\r\n      a <- a_query\r\n      b <- b_query\r\n      c <- c_query\r\n      abc <- abc_query\r\n      if a.id === abc.id_a &&\r\n        b.id === abc.id_b &&\r\n        c.id === abc.id_c &&\r\n        b.name.like(\"test\")\r\n    } yield (a.id, c.id)\r\n\r\n    println(\"Test 1:\")\r\n    println(q1.result.statements.head)\r\n  }\r\n  \r\n  /*\r\n  but, if we change it a bit... then works.\r\n   */\r\n  def test2 = {\r\n    val q1 = for {\r\n      a <- a_query\r\n      c <- c_query\r\n      (b, abc) <- b_query join abc_query on (_.id === _.id_b)\r\n      if a.id === abc.id_a &&\r\n        c.id === abc.id_c &&\r\n        b.name.like(\"test\")\r\n    } yield (a.id, c.id)\r\n\r\n    println(\"Test 2:\")\r\n    println(q1.result.statements.head)\r\n  }\r\n}\r\n```\r\n\r\nI hope this will help to people who had problems trying to migrate to new slick."},"comment":{"url":"https://api.github.com/repos/slick/slick/issues/comments/246097289","html_url":"https://github.com/slick/slick/issues/1316#issuecomment-246097289","issue_url":"https://api.github.com/repos/slick/slick/issues/1316","id":246097289,"user":{"login":"lisinge","id":22270,"avatar_url":"https://avatars.githubusercontent.com/u/22270?v=3","gravatar_id":"","url":"https://api.github.com/users/lisinge","html_url":"https://github.com/lisinge","followers_url":"https://api.github.com/users/lisinge/followers","following_url":"https://api.github.com/users/lisinge/following{/other_user}","gists_url":"https://api.github.com/users/lisinge/gists{/gist_id}","starred_url":"https://api.github.com/users/lisinge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lisinge/subscriptions","organizations_url":"https://api.github.com/users/lisinge/orgs","repos_url":"https://api.github.com/users/lisinge/repos","events_url":"https://api.github.com/users/lisinge/events{/privacy}","received_events_url":"https://api.github.com/users/lisinge/received_events","type":"User","site_admin":false},"created_at":"2016-09-10T07:34:02Z","updated_at":"2016-09-10T07:34:02Z","body":"@sweepy84 Might be because that the bug here was resolved but there still are more bugs, for example i opened a new issue here https://github.com/slick/slick/issues/1408"}}
{"actor":{"display_login":"lisinge"}}