Bug #21784
closedORA-00918: column ambiguously defined
0%
Description
When using DBAL and trying to use function menu "Indexed Search" from Web > Info, this error is raised.
Analyzing the problem is related to the way a query is constructed in modfunc1/class.tx_indexedsearch_modfunc1.php:
$res = $GLOBALS['TYPO3_DB']->execSELECTquery(
'ISEC.*, IP.*, count(*) AS count_val',
'index_phash IP, index_section ISEC',
...
Problem is that both index_phash and index_section contains a column with same name (that is btw used for joining them together), column phash. This results in an invalid query when using DBAL because this query uses a LIMIT to restrict the number of rows returned and the limit is handled by AdoDB by encapsulating the query into another one:
SELECT * FROM (SELECT ISEC.*, ...) WHERE rownum <= 101
And this causes the ORA-00918 error.
Solution:
Don't use .* but list needed columns. Note: this is a quick hack for this very query. In general explicitly listing all columns, even if "not fun" should be done to ensure mapping may apply to fields and to prevent those bugs.
(issue imported from #M12903)
Files