Hey,
I have some query API module in which some SQL error is occurring. Now MediaWiki is very helpful in truncating the lines in such a way I can't actually make sense of the error message.
Well, what column is unknown?
How can I turn of this truncating, or otherwise see the error (preferably w/o having to dig though some log file somewhere)? I have this already:
$wgShowExceptionDetails = true; $wgShowSQLErrors = true; $wgDebugComments = true; $wgLogQueries = true; $wgDebugDumpSql = true; $wgDevelopmentWarnings = true;
Cheers
-- Jeroen De Dauw http://www.bn2vs.com Don't panic. Don't be evil. --
Jeroen De Dauw <jeroendedauw <at> gmail.com> writes:
How can I turn of this truncating, or otherwise see the error (preferably w/o having to dig though some log file somewhere)? I have this already:
$wgDebugDumpSql = true;
This is the one you want, but the log messages are still truncated, unfortunately. The culprit is line 510 of includes/db/Database.php:
$sqlx = substr( $commentedSql, 0, 500 );
If you just want to hack it really quickly (as I have done in the past) just increase that number. The proper fix is probably to add some flag for logging the full SQL.
Owen
Hey,
$sqlx = substr( $commentedSql, 0, 500 );
What's the reason for this line? Why truncate after 500 chars?
Cheers
-- Jeroen De Dauw http://www.bn2vs.com Don't panic. Don't be evil. --
On Sat, Sep 3, 2011 at 8:45 PM, Jeroen De Dauw jeroendedauw@gmail.comwrote:
$sqlx = substr( $commentedSql, 0, 500 );
What's the reason for this line? Why truncate after 500 chars?
Now that's a good question! I did some digging and finally found the revision in which that line was added: http://www.mediawiki.org/wiki/Special:Code/MediaWiki/1914 by Tim, dating back to November 2003. Tim might know why that limitation is there, although the code is ooooooold -- I don't think anyone has objections to making the limit configurable at least (but correct me if I'm wrong).
Thanks and regards, -- Jack Phoenix MediaWiki developer
Jack Phoenix wrote:
On Sat, Sep 3, 2011 at 8:45 PM, Jeroen De Dauwjeroendedauw@gmail.comwrote:
$sqlx = substr( $commentedSql, 0, 500 );
What's the reason for this line? Why truncate after 500 chars?
Probably to avoid storing several megabytes inside the sql dump when people save articles.
Now that's a good question! I did some digging and finally found the revision in which that line was added: http://www.mediawiki.org/wiki/Special:Code/MediaWiki/1914 by Tim, dating back to November 2003. Tim might know why that limitation is there, although the code is ooooooold -- I don't think anyone has objections to making the limit configurable at least (but correct me if I'm wrong).
I think the real source is r1834
http://svn.wikimedia.org/viewvc/mediawiki/branches/stable/phase3/includes/Da...
On Sat, Sep 3, 2011 at 1:45 PM, Jeroen De Dauw jeroendedauw@gmail.com wrote:
What's the reason for this line? Why truncate after 500 chars?
SQL queries can be extremely, extremely long, running to many kilobytes or even a megabyte plus. Platonides is right that one major culprit would be saving an article. They can also get really long if you have big IN lists or other things like that. 500 chars might be overly conservative, though.
wikitech-l@lists.wikimedia.org