Page MenuHomePhabricator

Error deleting an uploaded file
Closed, ResolvedPublic

Description

Author: jeremy.m.cook

Description:
When I log in as administrator to my mediawiki, I cannot delete a file that was previously uploaded:

Warning: pg_query() [function.pg-query]: Query failed: ERROR: function concat(text, "unknown") does not exist HINT: No function matches the given name and argument types. You may need to add explicit type casts. in /home/local/g4wiki/includes/DatabasePostgres.php on line 516
Intern feil

A database error has occurred 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,'.jpg')),'1','2007-11-29 11:00:27 GMT','',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 = '2007-11-23-202039.jpg' Function: LocalFileDeleteBatch::doDBInserts Error: 1 ERROR: function concat(text, "unknown") does not exist HINT: No function matches the given name and argument types. You may need to add explicit type casts.

Backtrace:

#0 /home/local/g4wiki/includes/Database.php(796): DatabasePostgres->reportQueryError('ERROR: functio...', 1, 'INSERT INTO fi...', 'LocalFileDelete...', false)
#1 /home/local/g4wiki/includes/Database.php(1862): Database->query('INSERT INTO fi...', 'LocalFileDelete...')
#2 /home/local/g4wiki/includes/filerepo/LocalFile.php(1216): Database->insertSelect('filearchive', 'image', Array, Array, 'LocalFileDelete...')
#3 /home/local/g4wiki/includes/filerepo/LocalFile.php(1297): LocalFileDeleteBatch->doDBInserts()
#4 /home/local/g4wiki/includes/filerepo/LocalFile.php(873): LocalFileDeleteBatch->execute()
#5 /home/local/g4wiki/includes/FileDeleteForm.php(75): LocalFile->delete('')
#6 /home/local/g4wiki/includes/ImagePage.php(493): FileDeleteForm->execute()
#7 /home/local/g4wiki/includes/Wiki.php(397): ImagePage->delete()
#8 /home/local/g4wiki/includes/Wiki.php(48): MediaWiki->performAction(Object(OutputPage), Object(ImagePage), Object(Title), Object(User), Object(WebRequest))
#9 /home/local/g4wiki/index.php(89): MediaWiki->initialize(Object(Title), Object(OutputPage), Object(User), Object(WebRequest))
#10 {main}

I am using the patched DatabasePostgres.php as found here (but it doesnt seem to make any difference if I go back to the original, the same error occurs with a different line number):

http://svn.wikimedia.org/viewvc/mediawiki?view=rev&revision=26040

I get another, possibly similar or the same, error when uploading an update to an existing file.

I have postgres 8.1 on UBUNTU


Version: 1.11.x
Severity: major

Details

Reference
bz12147

Related Objects

View Standalone Graph
This task is connected to more than 200 other tasks. Only direct parents and subtasks are shown here. Use View Standalone Graph to show more of the graph.
StatusSubtypeAssignedTask
InvalidNone
ResolvedNone

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 9:58 PM
bzimport set Reference to bz12147.
bzimport added a subscriber: Unknown Object (MLST).

theurge14 wrote:

(In reply to comment #0)

When I log in as administrator to my mediawiki, I cannot delete a file that was
previously uploaded:

I can confirm I get this error on MediaWiki 1.11.0, PostgresSQL 8.2.5 and PHP 5.2.5 on FreeBSD 6.2. It does leave me unable to delete or update already uploaded files.

Here's my similar error output:

Warning: pg_query() [function.pg-query]: Query failed: ERROR: function concat(text, "unknown") does not exist LINE 1: ..._timestamp) SELECT 'deleted',IF(img_sha1='', '', CONCAT(img... ^ HINT: No function matches the given name and argument types. You may need to add explicit type casts. in /usr/local/www/mediawiki/mediawiki-1.11.0/includes/DatabasePostgres.php on line 506
Internal error

A database error has occurred 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,'.png')),'2','2007-11-29 16:31:39 GMT','',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 = 'Stinger-Provision-HDSL-9.png' Function: LocalFileDeleteBatch::doDBInserts Error: 1 ERROR: function concat(text, "unknown") does not exist LINE 1: ..._timestamp) SELECT 'deleted',IF(img_sha1='', '', CONCAT(img... ^ HINT: No function matches the given name and argument types. You may need to add explicit type casts.

Backtrace:

#0 /usr/local/www/mediawiki/mediawiki-1.11.0/includes/Database.php(779): DatabasePostgres->reportQueryError('ERROR: functio...', 1, 'INSERT INTO fi...', 'LocalFileDelete...', false)
#1 /usr/local/www/mediawiki/mediawiki-1.11.0/includes/Database.php(1845): Database->query('INSERT INTO fi...', 'LocalFileDelete...')
#2 /usr/local/www/mediawiki/mediawiki-1.11.0/includes/filerepo/LocalFile.php(1216): Database->insertSelect('filearchive', 'image', Array, Array, 'LocalFileDelete...')
#3 /usr/local/www/mediawiki/mediawiki-1.11.0/includes/filerepo/LocalFile.php(1297): LocalFileDeleteBatch->doDBInserts()
#4 /usr/local/www/mediawiki/mediawiki-1.11.0/includes/filerepo/LocalFile.php(873): LocalFileDeleteBatch->execute()
#5 /usr/local/www/mediawiki/mediawiki-1.11.0/includes/FileDeleteForm.php(75): LocalFile->delete('')
#6 /usr/local/www/mediawiki/mediawiki-1.11.0/includes/ImagePage.php(491): FileDeleteForm->execute()
#7 /usr/local/www/mediawiki/mediawiki-1.11.0/includes/Wiki.php(397): ImagePage->delete()
#8 /usr/local/www/mediawiki/mediawiki-1.11.0/includes/Wiki.php(48): MediaWiki->performAction(Object(OutputPage), Object(ImagePage), Object(Title), Object(User), Object(WebRequest))
#9 /usr/local/www/mediawiki/mediawiki-1.11.0/index.php(89): MediaWiki->initialize(Object(Title), Object(OutputPage), Object(User), Object(WebRequest))
#10 {main}

Please try out r26043, which should fix these problems.

Jdforrester-WMF subscribed.

Migrating from the old tracking task to a tag for PostgreSQL-related tasks.