{"issue":{"state":"open","pull_request":{"diff_url":null,"html_url":null,"patch_url":null},"milestone":null,"user":{"avatar_url":"https://secure.gravatar.com/avatar/2ac671a851f2e80837d479022c9866cf?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"2ac671a851f2e80837d479022c9866cf","url":"https://api.github.com/users/jpzwarte","login":"jpzwarte","id":3968},"assignee":null,"updated_at":"2011-11-14T12:34:55Z","labels":[],"closed_at":null,"comments":7,"url":"https://api.github.com/repos/rails-sqlserver/activerecord-sqlserver-adapter/issues/135","body":"The following Rails code generates the SQL query below that. The problem is that SQLServer doesn't accept the query, claiming it has an invalid syntax for the INNER JOIN.\r\n\r\n    Lms::Result.joins(:course).where(course: { uniqueid: course_id }).delete_all\r\n\r\n    DELETE FROM [lr] INNER JOIN [course] ON [course].[id] = [lr].[courseid] WHERE [course].[uniqueid] = N'1234'\r\n\r\nIt's a legacy database, so that's why the schema doesn't follow rails conventions.\r\n\r\nThe error returned is:\r\n\r\n    TinyTds::Error: Incorrect syntax near the keyword 'INNER'.: DELETE FROM [lr] INNER JOIN [course] ON [course].[id] = [lr].[courseid] WHERE [course].[uniqueid] = N'1234'\r\n\r\nRunning in the SMS gives the same result.","html_url":"https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/issues/135","title":"Invalid generated SQL for DELETE with INNER JOIN","number":135,"id":2033423,"created_at":"2011-10-24T13:12:12Z"},"action":"created","comment":{"user":{"avatar_url":"https://secure.gravatar.com/avatar/802f7b7813d7c349a84d444d43cb31ee?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"802f7b7813d7c349a84d444d43cb31ee","url":"https://api.github.com/users/metaskills","login":"metaskills","id":2381},"updated_at":"2011-11-14T12:34:55Z","url":"https://api.github.com/repos/rails-sqlserver/activerecord-sqlserver-adapter/issues/comments/2729838","body":"I was confused by going thru all the coerced tests boiler plate I write. That is only needed when we are over riding a previously defined test of active record with our own. So I assumed there was an original #test_delete_all_with_join that you were coercing. I searched and could not find it. I did see this old 3 ticket in lighthouse.\r\n\r\nhttps://rails.lighthouseapp.com/projects/8994/tickets/6555-delete_all-doesnt-work-when-chained-with-joins\r\n\r\nI won't have time to help with this for a week or so. It sounds like a deep code dive into the adapter. Perhaps a change in our Arel visitor too. Hell, maybe even in ActiveRecord. If you do have the time, I'd gladly stop and mentor every now and then, but I see no quick place to go off hand and start looking.","id":2729838,"created_at":"2011-11-14T12:34:55Z"}}