Last modified: 2012-08-04 20:49:10 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 T16414, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 14414 - maintenance/updateSpecialPages.php tries to INSERT invalid values
maintenance/updateSpecialPages.php tries to INSERT invalid values
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Database (Other open bugs)
1.13.x
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks: postgres
  Show dependency treegraph
 
Reported: 2008-06-05 16:45 UTC by David Nies
Modified: 2012-08-04 20:49 UTC (History)
2 users (show)

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


Attachments
Error Log (3.92 KB, text/plain)
2008-06-05 16:45 UTC, David Nies
Details
Debug output ($wgDebugLogfile) (28.84 KB, text/plain)
2008-06-05 18:23 UTC, David Nies
Details

Description David Nies 2008-06-05 16:45:14 UTC
Created attachment 4956 [details]
Error Log

My system setting is: 1.13alpha (r35900), PHP 5.2.0, PostgreSQL 8.1.11.

When I try to run the maintenance script "updateSpecialPages.php" (on the shell), I get the following error output:

 Ancientpages                   
Warning: pg_query(): Query failed: ERROR:  syntax error at or near "," at character 154 in /home/david/www/david.theparticulars.org/htdocs/w/includes/DatabasePostgres.php on line 557
got 4 rows in 0.03s
BrokenRedirects                got 0 rows in 0.01s
Deadendpages                   
Warning: pg_query(): Query failed: ERROR:  invalid input syntax for integer: "TPO_Weblog" in /home/david/www/david.theparticulars.org/htdocs/w/includes/DatabasePostgres.php on line 557
got 1 rows in 0.02s
Disambiguations                got 0 rows in 0.07s
DoubleRedirects                got 0 rows in 0.01s
Listredirects                  
Warning: pg_query(): Query failed: ERROR:  syntax error at or near "," at character 149 in /home/david/www/david.theparticulars.org/htdocs/w/includes/DatabasePostgres.php on line 557
(...)

which goes on. I omitted it because of its length, but you can find the whole output in my attachment (err.txt).
Comment 1 David Nies 2008-06-05 18:23:28 UTC
Created attachment 4957 [details]
Debug output ($wgDebugLogfile)
Comment 2 David Nies 2008-06-05 18:24:16 UTC
I added the whole debug output ($wgDebugLogFile) in the attached file "Debug output ($wgDebugLogfile)"
Comment 3 OverlordQ 2008-08-15 08:39:14 UTC
When I ran the query I had problems with the following special pages:

==
Uncategorizedcategories 
Uncategorizedpages 
Uncategorizedimages
Uncategorizedtemplates
Unusedimages
Withoutinterwiki
==

This is likely due to my test wiki being relatively empty.

For the first one, Uncategorizedcategories, you get the following query:
==
SELECT
                        'Uncategorizedcategories' as type,
                        page_namespace AS namespace,
                        page_title AS title,
                        page_title AS value
                FROM page
                LEFT JOIN categorylinks ON page_id=cl_from
                WHERE cl_from IS NULL AND page_namespace=14 AND page_is_redirect=0
                 ORDER BY value  LIMIT 1000  OFFSET 0
==

The problem is the page_title AS value.  In the ::recache function of QueryPage.php it uses the value field as an insert into the querycache.

==
INSERT /* UncategorizedCategoriesPage::recache  */ INTO querycache (qc_type,qc_namespace,qc_title,qc_value) VALUES ('Uncategorizedcategories','14','Rainbow_Tables','Rainbow_Tables')
==

Looking at tables.sql, qc_value should be an unsigned integer but the getSQL() function of SpecialUncategorizedpages.php is feeding it the page_title as seen above.  Just a hazarding a guess but this is likely the cause for the other errors as well.

This however should effect MySQL as well, so either MySQL is silently accepting a text field as an integer or MySQL is doing something else weird.
Comment 4 OverlordQ 2008-08-15 09:36:23 UTC
for the hellofit on MySQL:

==
mysql> SELECT * FROM querycache;
Empty set (0.01 sec)

mysql> INSERT   INTO querycache (qc_type,qc_namespace,qc_title,qc_value) VALUES ('Uncategorizedcategories','14','Rainbow_Tables','Rainbow_Tables');
Query OK, 1 row affected, 1 warning (0.00 sec)

mysql> SELECT * FROM querycache;
+-------------------------+----------+--------------+----------------+
| qc_type                 | qc_value | qc_namespace | qc_title       |
+-------------------------+----------+--------------+----------------+
| Uncategorizedcategories |        0 |           14 | Rainbow_Tables |
+-------------------------+----------+--------------+----------------+
1 row in set (0.01 sec)

==

So at least in MySQL's (non-strict) behavior it'll silently accept this invalid input and substitute a zero.

But enabling strict mode will throw an error:

==
mysql> SET SESSION sql_mode=STRICT_ALL_TABLES;
Query OK, 0 rows affected (0.00 sec)

mysql> INSERT   INTO querycache (qc_type,qc_namespace,qc_title,qc_value) VALUES ('Uncategorizedcategories','14','Rainbow_Tables','Rainbow_Tables');
ERROR 1366 (HY000): Incorrect integer value: 'Rainbow_Tables' for column 'qc_value' at row 1
==

So, renaming the bug since it isn't limited to PG, it's just PG by default throws an error.
Comment 5 Alexandre Emsenhuber [IAlex] 2009-02-21 17:31:39 UTC
fixed in r47622.

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


Navigation
Links