JoomFish / joomfish-2.5

Joom!Fish 2.5 core development
http://www.joomfish.net/
34 stars 27 forks source link

mod_lca triggers an database error "Not unique table/alias: 'jfself'" #68

Closed jsoderba closed 12 years ago

jsoderba commented 12 years ago

The mod_lca extension (http://extensions.joomla.org/extensions/news-display/articles-display/articles-structured-lists/10731) does not work because it triggers a database error: "Not unique table/alias: 'jfself'"

This is the query mod_lca attempts to execute with loadObjectList()

SELECT a.id, a.title, a.alias, a.catid, a.sectionid, c.alias as calias, a.created AS co FROM #content AS a LEFT JOIN #categories AS c ON c.id=a.catid WHERE ((a.state = 1 OR a.state = 2) ) AND (a.access=1 OR a.access=2) AND ( a.publish_up = '0000-00-00 00:00:00' OR a.publish_up <= '2012-05-14 12:55:59' ) AND ( a.publish_down = '0000-00-00 00:00:00' OR a.publish_down >= '2012-05-14 12:55:59' ) AND c.published = 1 AND a.catid IN (8,9,10) ORDER BY id desc LIMIT 150

This is what Joomfish ends up executing:

SELECT jfself.id AS id, a.id, a.title, a.alias, a.catid, a.sectionid, c.alias as calias, a.created AS co FROM aa64m_content AS a JOIN aa64m_content AS jfself USING (id) LEFT JOIN aa64m_content AS jfself USING (id) LEFT aa64m_categories AS c ON c.id=a.catid JOIN aa64m_content AS jfself USING (id) LEFT ((a.state = 1 OR a.state = 2) ) AND (a.access=1 OR a.access=2) AND ( a.publish_up = '0000-00-00 00:00:00' OR a.publish_up <= '2012-05-14 12:55:59' ) AND ( a.publish_down = '0000-00-00 00:00:00' OR a.publish_down >= '2012-05-14 12:55:59' ) AND c.published = 1 AND a.catid IN (8,9,10) ORDER BY id desc LIMIT 150

It looks like there may be a bug in how jf handles complex joins.

I am using Joomla 2.5.4, mod_lca 0.9.5 and the latest revision of jf-future (commit fe20bda5ee)