Here some progress : https://github.com/web2py/pydal/issues/521

On Fri, Aug 4, 2017 at 12:57 PM, villas <[email protected]> wrote:

> With a where clause,  it works OK.
> However,  in my example,  I still should not have generated a CROSS JOIN.
> I guess it's just a pyDAL issue.
>
>
>
>
> On Friday, 4 August 2017 17:25:14 UTC+1, villas wrote:
>>
>> According to the book,  I should be able to append 'join' statements to a
>> list.  Here is what happens:
>>
>> >>> joinlist = []
>> >>> joinlist.append( db.res.on(db.extra_dates.res_id == db.res.id) )
>> >>> joinlist.append( db.prop.on(db.res.prop_id == db.prop.id) )
>>
>> >>> db()._select(db.prop.id, join=joinlist )
>>
>> 'SELECT prop.id FROM extra_dates CROSS JOIN prop JOIN res ON
>> (extra_dates.res_id = res.id) JOIN prop ON (res.prop_id = prop.id) ORDER
>> BY prop.id;'
>>
>> This SQL is wrong and creates a ticket because an unwanted 'CROSS JOIN'
>> has been added.  In my case I am using Firebird,  but I believe this is
>> irrelevant because it happens in base.py which probably affects all DBs.
>>
>> I'm posting this initially here because the same problem
>> <https://groups.google.com/forum/#!searchin/web2py/cross$20join%7Csort:relevance/web2py/KpxWh4ikqG8/cDBbhiK_3F8J>
>> was posted a couple of years ago.
>>
>> Maybe there's a workaround, or I'm missing something?
>>
>>
>>
>>
>> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to