Issue Bug Closed

#19734t3lib_db explainOutput does not work with tablealias

Nabil Saleh 12/22/08, 17:11 updated 10/02/18, 12:30

Description

Using table aliases in an SQL having t3lib_db::explainOutput ==1 causes mysql errors as t3lib_db::explain function calles explain the executed query and uses returned tablenames to “SHOW INDEX FROM” it. The problem with this is that col ‘table’ returned by explain can be an alias from a table and then “SHOW INDEX FROM “ returns in “table does not exist” error.

code:
$GLOBALS[‘TYPO3_DB’]->exec_SELECTgetRows(‘a.uid,b.uid’,‘be_users a,be_users b’,‘1’);
produces:
caller t3lib_DB::exec_SELECTquery
ERROR Table ‘DBNAME.b’ doesn’t exist
lastBuiltQuery SELECT a.uid,b.uid
FROM be_users a,be_users b
WHERE
1

(issue imported from #M10003)

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.