Hello Eric,

I've had a closer look at this and I cannot seem to reproduce it simply. 
Can you provide me with some DDL creating the tables and the query that 
causes the issue?

Cheers
Lukas

On Monday, April 23, 2012 9:58:59 PM UTC+2, Eric Schwarzenbach wrote:
>
> I ran into this in 2.1.0...haven't tried it with the new release yet, 
> as I didn't see anything in the list of fixes that sounded relevant. 
> And somehow I missed that there was 2.2.x series...I'll be upgrading 
> to that soon. 
>
> But what I am seeing is jooq giving me the wrong column value, in a 
> situation like this: 
>
>                     PublicFactory create = new PublicFactory(conn); 
>                     Result<Record> result = 
>                                     create.select().from(A) 
>                                     .join(B) 
>                                     .on(A.ID.equal(B.A_ID)) 
>                                     .join(ORGANIZATION)        ; 
> ... 
>
> rec.getValue(rec.getField(B.ID)); // this ends up giving me the value 
> for A.ID! 
>
> This is simplified of course, but hopefully the gist is obvious 
> enough...the result of the join has two "id" columns one from a and 
> one from b, and when I ask for b's id, it gives me a's. 
>
> Now I realize the columns really are ambiguous in the underlying SQL 
> and result. And I've already fixed my code to use aliases in the 
> select. In fact normally when writing SQL directly I simply ALWAYS use 
> column aliases (and table aliases)..it makes life simpler and actually 
> makes the syntax shorter. 
>
> But since Jooq is allowing me to specify B.ID, it seems to me it ought 
> to do whatever it needs to ensure that this is what it gives me. 
> (Perhaps joog should generate aliases in the sql and map them to the 
> table field names.) 
>
> Apologies if this is already made irrelevant by Jooq 2.2 or if it is 
> in the bug tracking system already and I failed to find it.

Reply via email to