#68 multiple left join fix

closed-fixed
None
5
2006-08-15
2006-07-03
Pau Aliagas
No

I having problems trying to create a query with two
left joins as only one allows having the left table
specified, the rest have to be None, otherwise it
generates invalid SQL.

The theory is that if you don't specify the left table,
it joins agains the first table defined. In this case
you don't need a comma before the left join.

But if you want to define both tables (the recommended
procedure), you need a leading comma.

As it is now, you cannot mix them:
if tables and join[0].table1:
join_str = ", "
else:
join_str = ' '
join_str += " ".join([self.sqlrepr(j) for j
in join])

As I propose, every joind is treated individually:

join_str = ""
for j in join:
if tables and j.table1:
sep = ", "
else:
sep = ' '
join_str += sep + self.sqlrepr(j)

I attach the patch. I posted it in the mailing lisrt
without any reposnse.

Discussion

  • Pau Aliagas

    Pau Aliagas - 2006-07-03

    multiple joins fix

     
  • Oleg Broytman

    Oleg Broytman - 2006-08-15

    Logged In: YES
    user_id=4799

    Well... I have created a test myself, applied the patch and
    committed in the revision 1859 to the trunk, rev. 1860 to
    the 0.7-branch.

     
  • Oleg Broytman

    Oleg Broytman - 2006-08-15
    • assigned_to: nobody --> phd
    • status: open --> closed-fixed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks