Project

General

Profile

Actions

Bug #30486

closed

Typoscript select join broken

Added by Christof Rodejohann over 12 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
-
Target version:
-
Start date:
2011-09-30
Due date:
% Done:

0%

Estimated time:
2.00 h
TYPO3 Version:
4.6
PHP Version:
Tags:
Complexity:
easy
Is Regression:
Sprint Focus:

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.


Related issues 2 (0 open2 closed)

Is duplicate of TYPO3 Core - Bug #29783: getQuery: fields explicilty added on select <table>.* : Error: ambigious parameter uidClosedBjörn Pedersen2011-10-11

Actions
Follows TYPO3 Core - Bug #17284: no content in workspace preview when using select.selectFieldsClosedBenni Mack2007-05-07

Actions
Actions #1

Updated by Steffen Gebert over 12 years ago

  • Target version deleted (4.6.0-RC1)
Actions #2

Updated by Steffen Gebert over 12 years ago

  • Status changed from New to Needs Feedback

Could you please provide a simple example to reproduce?

Actions #3

Updated by Christof Rodejohann over 12 years ago

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
Actions #4

Updated by Peter Niederlag over 12 years ago

  • Status changed from Needs Feedback to Accepted
  • Estimated time set to 2.00 h
  • Complexity set to easy

IMO the $table can just easily be added on the fieldname as $table is already available anyway in patch from #17284 http://forge.typo3.org/projects/typo3v4-core/repository/revisions/e13d917ec8531d572fba295c7cbc06f44ea16750/diff/typo3/sysext/cms/tslib/class.tslib_content.php
Christoph, could you mabe create/submit a proper patch?

Actions #5

Updated by Xavier Perseguers over 12 years ago

The table can be added, yes, but I guess one may have to take care of proper possible aliasing

Actions #6

Updated by Helmut Hummel over 12 years ago

  • Status changed from Accepted to Resolved

Resolved as duplicate.

Older branches luckily are not affected, as issue #17284 has been blocked for these branches (see https://review.typo3.org/4951 and https://review.typo3.org/4950)

Actions #7

Updated by Benni Mack over 5 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF