#1249 confirmed

Incorrect table name in join

Reported by Alex | April 18th, 2010 @ 02:57 PM | in 1.1.1

This issue was discussed here, back in January: http://irclogger.com/datamapper/2010-01-14#1263459912. Short summary: joins are screwed up when joining to more than one table.

I can't find a ticket for it and it's still a problem in master. The problem is described here: http://gist.github.com/276940.

The target_alias for the join should be based on relationship instead of previous source_alias. I have patched the problem here: http://github.com/alexkwolfe/dm-do-adapter/commit/cbc97c39da6e1ee4d....

Comments and changes to this ticket

  • Martin Gamsjaeger (snusnu)

    Martin Gamsjaeger (snusnu) April 18th, 2010 @ 06:33 PM

    • State changed from “new” to “confirmed”
  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) May 21st, 2010 @ 02:56 PM

    • Assigned user set to “Dan Kubb (dkubb)”

    I'm not entirely sure the proposed fix will work in all cases. I am actually not going to modify any SQL generation code until after 1.0 launches, and we're able to spec the query generation better.

    Currently the queries that are generated are a bit opaque because they are generated inside the DO adapter and it's difficult to spec them, especially in complex scenarios. The plan is to rip out SQL generation into a separate class, and then test it stand-alone. It will accept a DM::Query object and return the appropriate SQL statement. There will be other classes that handle operations and comparisons so that those can be unit tested in isolation as well.

    This change will also make it possible to add a #to_sql method to DM::Query, allowing more visibility into what SQL query the system will generate when a collection is evaluated.

  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) May 21st, 2010 @ 04:33 PM

    • Assigned user cleared.

    Moving this to unassigned because I am not actively working on it until after 1.0.

  • Piotr Solnica (solnic)

    Piotr Solnica (solnic) March 24th, 2011 @ 06:57 AM

    • Milestone set to 1.1.1
    • Milestone order changed from “0” to “0”

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »