I have been running a mediawiki server for many years now at my company. Recently to combat a problem I was having with PDF uploading when they contained metadata, I have moved to the latest revision of all the software on my Gentoo box (Mediawiki 1.18.1, PHP 5.4.0, PostgreSQL 9.1.3)
Now certain pages (two category pages which receive heavy usage) return the same PHP error.
Warning: Illegal string offset 'LIMIT' in /var/www/localhost/htdocs/includes/db/Database.php on line 1377
It then has 5 or 6 complaints about that error. Then comes the line:
Warning: Invalid argument supplied for foreach() in /var/www/localhost/htdocs/includes/resourceloader/ResourceLoaderWikiModule.php on line 177
Then says the whole thing is a mediawiki internal error.
It then tells me that the original exception:
Original exception: exception 'DBQueryError' with message 'A database error has occurred. Did you forget to run maintenance/update.php after upgrading? See: Query: SELECT COUNT(*) AS pages,COUNT( (CASE WHEN page_namespace=14 THEN 1 ELSE NULL END) ) AS subcats,COUNT( (CASE WHEN page_namespace=6 THEN 1 ELSE NULL END) ) AS files FROM "categorylinks","page" WHERE cl_to = 'Item_Groups' AND (page_id = cl_from) LOCK IN SHARE MODE
Function: Category::refreshCounts
Error: 1 ERROR: syntax error at or near "LOCK"
LINE 1: ...E cl_to = 'Item_Groups' AND (page_id = cl_from) LOCK IN SH...
I have gone into the database and have determined that when I run this same query from the database itself, I get the same error and same result.
And YES I have run the update.php function.
I tried a backdoor delete of the affected pages (manually applying the URL directly to the delete form). I then purged the database of all the archived pages (AKA, deleted pages) using the maintenance script. All to no avail. The database has some weird issue with these pages, and I cannot figure out how to purge them so that I can recreate them again!