This is a follow-up to ticket #394 [PATCH] Fixed non-standard SQL generated by preloading has_and_belongs_to_man.... After
#394 [PATCH] Fixed non-standard SQL generated by preloading has_and_belongs_to_man...
was set to "resolved" there was discussion of another bug in the
SQL that never got resolved.
The habtm :joins clause includes an extra "as" that generates
non-standard SQL, causing it to break in Oracle. In INNER JOIN
clauses, you can "INNER JOIN my_table t0" but you can't "INNER JOIN
my_table as t0" which is the current behavior. MySQL and other dbs
are tolerant of the extra "as," but Oracle throws a fit.
You can verify this with a SQL syntax checker: http://developer.mimer.com/valid...
Old output:
SELECT developers.*, t0.project_id as _parent_record_id
FROM developers
INNER JOIN developers_projects as t0 ON developers.id = t0.developer_id
WHERE (t0.project_id IN (1,2))
New output:
SELECT developers.*, t0.project_id as _parent_record_id
FROM developers
INNER JOIN developers_projects t0 ON developers.id = t0.developer_id
WHERE (t0.project_id IN (1,2))
No new tests are necessary, as no new behaviors are being
added.