[TYPO3-core] RFC #12903: ORA-00918: column ambiguously defined [indexed_search]

Xavier Perseguers typo3 at perseguers.ch
Thu Dec 3 12:16:38 CET 2009


Hi,

This is an SVN patch request.

Type: Bugfix when using DBAL and Oracle

BT reference:
http://bugs.typo3.org/view.php?id=12903

Branches: trunk, 4_3

Problem:
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.

-- 
Xavier Perseguers
http://xavier.perseguers.ch/en

One contribution a day keeps the fork away
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 12903.diff
URL: <http://lists.typo3.org/pipermail/typo3-team-core/attachments/20091203/4d7b3c3d/attachment.txt>


More information about the TYPO3-team-core mailing list