Last modified: 2014-02-12 23:32:49 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T45533, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 43533 - Error: ORA-00904: "ARRAY": invalid identifier with ORACLE (DatabaseOracle::doQuery)
Error: ORA-00904: "ARRAY": invalid identifier with ORACLE (DatabaseOracle::do...
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Database (Other open bugs)
1.20.x
All All
: High critical (vote)
: ---
Assigned To: Jure Kajzer
:
Depends on:
Blocks: oracle
  Show dependency treegraph
 
Reported: 2012-12-31 10:30 UTC by Roy Olsen
Modified: 2014-02-12 23:32 UTC (History)
4 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Roy Olsen 2012-12-31 10:30:06 UTC
It is possible to work your way through the web installer, but that's where the story ends. 

Just about anything you do will result in:

A database query syntax error has occurred. This may indicate a bug in the software. The last attempted database query was:
(SQL query hidden)
from within function "DatabaseOracle::doQuery". Database returned error "904: ORA-00904: "ARRAY": invalid identifier".

Reproduced on:

MediaWiki	1.20.2
PHP	5.3.14 (apache2handler)
Oracle	11.2.0.2.0
Comment 1 Jesús Martínez Novo (Ciencia Al Poder) 2012-12-31 10:42:50 UTC
There was another report (with the same error) on the Support Desk a few days ago:

http://www.mediawiki.org/wiki/Thread:Project:Support_desk/mediawiki_+_oracle_invalid_identifier
Comment 2 Roy Olsen 2012-12-31 11:00:16 UTC
Problem does not exist in 1.19.3, I have not tried the previous 1.20.x releases.
Comment 3 Jure Kajzer 2012-12-31 11:14:18 UTC
ARRAY??? where exactly are ARRAYs used?
Comment 4 Roy Olsen 2012-12-31 11:18:12 UTC
Apparently on line 1168 of htdocs/includes/db/DatabaseOracle.php
Comment 5 Jure Kajzer 2012-12-31 11:29:13 UTC
??  in 1.19 that points to useIndexClause call whuch should ge DatabaseBase's return ''; function ... what's in your 1168 line of DatabaseOracle.php?
Comment 6 Roy Olsen 2012-12-31 11:36:20 UTC
In 1.20.2 it's

  if ( isset( $options['GROUP BY'] ) ) {
                        $preLimitTail .= " GROUP BY {$options['GROUP BY']}";
                }
  if ( isset( $options['ORDER BY'] ) ) {
                        $preLimitTail .= " ORDER BY {$options['ORDER BY']}";
                }


This code appears unchanged from 1.9.3, so I suppose the notice about array to string conversion (from the support desk report) must be unrelated to the actual problem.
Comment 7 Roy Olsen 2012-12-31 12:10:48 UTC
I tried a few different installations and was able to reproduce the problem in 

* 1.20.0
* 1.20.1 
* 1.20.2

Problem does not exist in:

* 1.19.3 and prior
Comment 8 Roy Olsen 2012-12-31 12:24:23 UTC
Actually, it looks like $preLimitTail is concatinated with  "Array" after the conversion resulting in "ORDER BY Array" or "GROUP BY Array" in the final SQL. 

I'm sure this is supposed to be replaced by the actual column name?
Comment 9 Roy Olsen 2012-12-31 12:32:48 UTC
Confirmed. Commenting out lines 1165 and 1168 works around the problem.

//                      $preLimitTail .= " GROUP BY {$options['GROUP BY']}";

I suppose there is another array inside $options['GROUP BY'] that should be imploded?
Comment 10 Jure Kajzer 2012-12-31 12:35:29 UTC
yes i noticed ... somone changed the function in base and like usual 0FWG about the overloads. I'm fixing it ATM.
Comment 11 Roy Olsen 2012-12-31 12:41:57 UTC
Allright, here we go. I stole some code from includes/db/DatabasePostgres.php to implode the array before setting $preLimitTail.

[roy@lonora02 db]# diff DatabaseOracle.php DatabaseOracle.php.orig
1165,1167d1164
<                        $ob = is_array( $options['GROUP BY'] )
<                                 ? implode( ',', $options['GROUP BY'] )
<                                 : $options['GROUP BY'];
1171,1173d1167
<                        $ob = is_array( $options['ORDER BY'] )
<                                 ? implode( ',', $options['ORDER BY'] )
<                                 : $options['ORDER BY'];
Comment 12 Jure Kajzer 2012-12-31 12:52:29 UTC
seems like this method overload is obsolete ... running phpunit test with it removed now.
Comment 13 Roy Olsen 2012-12-31 12:57:09 UTC
Oh, I missed a spot, $ob must be returned instead of $options['ORDER BY']:

[roy@lonora02 db]# diff DatabaseOracle.php DatabaseOracle.php.orig 
1165,1168c1165
<                        $ob = is_array( $options['GROUP BY'] )
<                                 ? implode( ',', $options['GROUP BY'] )
<                                 : $options['GROUP BY'];
< 			$preLimitTail .= " GROUP BY {$ob}";
---
> 			$preLimitTail .= " GROUP BY {$options['GROUP BY']}";
1171,1174c1168
<                        $ob = is_array( $options['ORDER BY'] )
<                                 ? implode( ',', $options['ORDER BY'] )
<                                 : $options['ORDER BY'];
< 			$preLimitTail .= " ORDER BY {$ob}";
---
> 			$preLimitTail .= " ORDER BY {$options['ORDER BY']}";

I don't know the first thing about coding in php, but this worked for me :)
Comment 14 Jure Kajzer 2012-12-31 14:34:40 UTC
current fixed in https://gerrit.wikimedia.org/r/#/c/41575/

has to be backported or you can just use the patch Roy suggested
Comment 15 Umherirrender 2012-12-31 15:19:50 UTC
The array maybe cames from Gerrit change #7521 and/or Gerrit change #22208
Comment 16 Jure Kajzer 2012-12-31 18:59:26 UTC
no the array is from before that ... but i'm not always up to date with such changes as i just don't notice them, until something breaks ... liiiike now.

I'm assigning this bug to myself until i get the time to backport it to at least 1.20
Comment 17 Umherirrender 2013-03-02 10:35:36 UTC
(In reply to comment #15)
> The array maybe cames from Gerrit change #7521 and/or Gerrit change #22208

Added array support for GROUP BY with HAVING and ORDER BY for all dbms with Gerrit change #45799

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links