Last modified: 2012-08-04 20:48:58 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 T16337, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 14337 - Can't delete images with postgres backend
Can't delete images with postgres backend
Status: RESOLVED DUPLICATE of bug 11598
Product: MediaWiki
Classification: Unclassified
Database (Other open bugs)
1.11.x
All All
: Normal major (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks: postgres
  Show dependency treegraph
 
Reported: 2008-05-29 21:01 UTC by Simeon Veldstra
Modified: 2012-08-04 20:48 UTC (History)
2 users (show)

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


Attachments
Fix for non-standard SQL in query (824 bytes, patch)
2008-05-29 21:01 UTC, Simeon Veldstra
Details

Description Simeon Veldstra 2008-05-29 21:01:08 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,
                                 fa_storage_key,
                                 fa_deleted_user,
                                 fa_deleted_timestamp,
                                 fa_deleted_reason,
                                 fa_deleted,
                                 fa_name,
                                 fa_archive_name,
                                 fa_size,
                                 fa_width,
                                 fa_height,
                                 fa_metadata,
                                 fa_bits,
                                 fa_media_type,
                                 fa_major_mime,
                                 fa_minor_mime,
                                 fa_description,
                                 fa_user,
                                 fa_user_text,
                                 fa_timestamp)
SELECT  'deleted',
        IF(img_sha1='', '', CONCAT(img_sha1,'.pdf')),
        '1',
        '2008-05-29 18:28:36 GMT',
        'This file was a test.',
        0,
        img_name,
        NULL,
        img_size,
        img_width,
        img_height,
        img_metadata,
        img_bits,
        img_media_type,
        img_major_mime,
        img_minor_mime,
        img_description,
        img_user,
        img_user_text,
        img_timestamp
FROM image   
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
construction.
Comment 1 Brion Vibber 2008-06-04 17:11:29 UTC
Please check with current development trunk in subversion; 1.11.1 is pretty old.
Comment 2 Greg Sabino Mullane 2008-06-04 17:36:50 UTC
Already fixed: see r26043

*** This bug has been marked as a duplicate of bug 11598 ***

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


Navigation
Links