Last modified: 2012-08-04 20:48:58 UTC
Created attachment 4937 [details]
Fix for non-standard SQL in query
Deleting images fails with this error:
Query: INSERT INTO filearchive (fa_storage_group,
IF(img_sha1='', '', CONCAT(img_sha1,'.pdf')),
'2008-05-29 18:28:36 GMT',
'This file was a test.',
WHERE img_name = 'Testpdf.pdf'
Function: LocalFileDeleteBatch::doDBInserts Error:
1 ERROR: function concat(text, "unknown") does not exist
[Error message reformatted]
The problem is the query uses the non-standard MySQL function
CONCAT to concatenate stings.
Additionaly, the code uses the MySQL IF function as a
conditional. This is also non-standard SQL.
I've attached a patch for mediawiki/includes/filerepo/LocalFile.php
that fixes the non-standard query. Unfortunately, this will
break sites using a MySQL backend, as MySQL does not support the
'||' ANSI standard string concatenation operator. It is possible
that the correct thing to do is move the concatenation out of the
query and into the php code.
The patch may help other postgres users in the meantime.
MySQL does understand the standard CASE WHEN THEN ELSE END
Please check with current development trunk in subversion; 1.11.1 is pretty old.
Already fixed: see r26043
*** This bug has been marked as a duplicate of bug 11598 ***