If I define the following in my postgresql database:
create table t1(i int, c varchar);
insert into t1 values(1, 'One');
insert into t1 values(2, 'Two');
create table t2(i int, c varchar);
insert into t2 values(1, 'Another one');
insert into t2 values(2, 'Another two');
And then define the following squeryl code to access it:
case class T1(i: Int, c: String)
case class T2(i: Int, c: String)
...
val t1s = table[T1]("t1")
val t2s = table[T2]("t2")
...
val q1 = from(t1s, t2s)((t1, t2) => where(t1.i === t2.i) select(t1, t2.c))
val q2 = from(q1)(r => select(r._1, r._2))
transaction {
println(from(q1)(r => select(r)).toList)
println(from(q2)(r => select(r)).toList)
}
It gives me the following output:
List((T1(1,One),Another one), (T1(2,Two),Another two))
List((T1(1,One),), (T1(2,Two),))
Why does it fail to return my the text fields from the join in the second query, ie. when I query the query?