Bug #30486
closed
Typoscript select join broken
Added by Christof Rodejohann about 13 years ago.
Updated about 6 years ago.
Description
The solution to #17284 has unwanted side effects.
You can find the following code in line 7421 in file typo3/sysext/cms/tslib/class.tslib_content.php
$queryParts['SELECT'] .= ',uid,pid';
If selecFields is set, any select query gets ',uid,pid' added. This breaks any typoscript join. When using a two tables join and the bare column 'uid' is added to field list, it is always ambiguous and results in a mysql error.
This might be relevant to other releases to (4.6, 4.5, 4.4), because the patch was applied there as well.
- Target version deleted (
4.6.0-RC1)
- Status changed from New to Needs Feedback
Could you please provide a simple example to reproduce?
Here you go:
page = PAGE
page.10 = COA
page.10 {
10 = CONTENT
10 {
table = tt_content
select {
selectFields = tt_content.header,be_users.username
join = be_users ON tt_content.cruser_id = be_users.uid
}
renderObj = COA
renderObj {
10 = TEXT
10.field = header
20 = TEXT
20.field = username
}
}
}
results in
caller
t3lib_DB::exec_SELECTquery
ERROR
Column 'uid' in field list is ambiguous
lastBuiltQuery
SELECT tt_content.header,be_users.username,uid,pid,t3ver_state FROM tt_content JOIN be_users ON tt_content.cruser_id = be_users.uid WHERE tt_content.pid IN (15) AND tt_content.deleted=0 AND tt_content.t3ver_state<=0 AND tt_content.pid!=-1 AND tt_content.hidden=0 AND tt_content.starttime<=1317397620 AND (tt_content.endtime=0 OR tt_content.endtime>1317397620) AND (tt_content.fe_group='' OR tt_content.fe_group IS NULL OR tt_content.fe_group='0' OR FIND_IN_SET('0',tt_content.fe_group) OR FIND_IN_SET('-1',tt_content.fe_group))
debug_backtrace
require#78 // include#417 // TSpagegen::renderContent#74 // tslib_cObj->cObjGet#303 // tslib_cObj->cObjGetSingle#548 // tslib_content_ContentObjectArray->render#601 // tslib_cObj->cObjGet#48 // tslib_cObj->cObjGetSingle#548 // tslib_content_Content->render#601 // tslib_cObj->exec_getQuery#101 // t3lib_DB->exec_SELECT_queryArray#7345 // t3lib_DB->exec_SELECTquery#258 // t3lib_DB->debug#191
- Status changed from Needs Feedback to Accepted
- Estimated time set to 2.00 h
- Complexity set to easy
The table can be added, yes, but I guess one may have to take care of proper possible aliasing
- Status changed from Accepted to Resolved
- Status changed from Resolved to Closed
Also available in: Atom
PDF