Cant replace image when using SQL Server backend: varchar vs. varbinary
Closed, ResolvedPublic

Description

Author: wikimedia

Description:
The bug is that the column datatype of oldimage.oi_metadata is varchar when it needs to match image.img_metadata, which is varbinary(MAX)

Debug:

Database error
A database query error has occurred. This may indicate a bug in the software.

Query:
INSERT INTO [MediaWiki].[oldimage] (oi_name,oi_archive_name,oi_size,oi_width,oi_height,oi_bits,oi_timestamp,oi_description,oi_user,oi_user_text,oi_metadata,oi_media_type,oi_major_mime,oi_minor_mime,oi_sha1) SELECT img_name,'20141017015118!DocumentManagementService_Soak.gif',img_size,img_width,img_height,img_bits,img_timestamp,img_description,img_user,img_user_text,img_metadata,img_media_type,img_major_mime,img_minor_mime,img_sha1 FROM [MediaWiki].[image] WHERE img_name = 'DocumentManagementService_Soak.gif'
Function: LocalFile::recordUpload2
Error: 257 [SQLSTATE 42000][Error Code 257][Microsoft][SQL Server Native Client 11.0][SQL Server]Implicit conversion from data type varchar to varbinary is not allowed. Use the CONVERT function to run this query. [SQLSTATE 42000][Error Code 8180][Microsoft][SQL Server Native Client 11.0][SQL Server]Statement(s) could not be prepared.
Backtrace:

#0 C:\inetpub\wwwroot\mediawiki\includes\db\Database.php(1123): DatabaseBase->reportQueryError('[SQLSTATE 42000...', 257, 'INSERT INTO [M...', 'LocalFile::reco...', false)
#1 C:\inetpub\wwwroot\mediawiki\includes\db\Database.php(2976): DatabaseBase->query('INSERT INTO [M...', 'LocalFile::reco...')
#2 C:\inetpub\wwwroot\mediawiki\includes\db\DatabaseMssql.php(733): DatabaseBase->insertSelect('oldimage', 'image', Array, Array, 'LocalFile::reco...', Array, Array)
#3 C:\inetpub\wwwroot\mediawiki\includes\filerepo\file\LocalFile.php(1317): DatabaseMssql->insertSelect('oldimage', 'image', Array, Array, 'LocalFile::reco...')
#4 C:\inetpub\wwwroot\mediawiki\includes\filerepo\file\LocalFile.php(1174): LocalFile->recordUpload2('20141017015118!...', '', false, Array, false, Object(User))
#5 C:\inetpub\wwwroot\mediawiki\includes\upload\UploadBase.php(694): LocalFile->upload('C:\\temp\\phpCB83...', '', false, 1, Array, false, Object(User))
#6 C:\inetpub\wwwroot\mediawiki\includes\specials\SpecialUpload.php(466): UploadBase->performUpload('', false, true, Object(User))
#7 C:\inetpub\wwwroot\mediawiki\includes\specials\SpecialUpload.php(185): SpecialUpload->processUpload()
#8 C:\inetpub\wwwroot\mediawiki\includes\specialpage\SpecialPage.php(379): SpecialUpload->execute(NULL)
#9 C:\inetpub\wwwroot\mediawiki\includes\specialpage\SpecialPageFactory.php(503): SpecialPage->run(NULL)
#10 C:\inetpub\wwwroot\mediawiki\includes\Wiki.php(285): SpecialPageFactory::executePath(Object(Title), Object(RequestContext))
#11 C:\inetpub\wwwroot\mediawiki\includes\Wiki.php(588): MediaWiki->performRequest()
#12 C:\inetpub\wwwroot\mediawiki\includes\Wiki.php(447): MediaWiki->main()
#13 C:\inetpub\wwwroot\mediawiki\index.php(46): MediaWiki->run()
#14 {main}


Version: 1.23.3
Severity: normal
OS: Windows Server 2008
Platform: PC

Details

Reference
bz72171
bzimport raised the priority of this task from to Normal.
bzimport set Reference to bz72171.
bzimport added a subscriber: Unknown Object (MLST).
bzimport created this task.Oct 17 2014, 2:21 AM
Skizzerz closed this task as Resolved.May 2 2016, 9:35 PM
Skizzerz claimed this task.
Skizzerz added a subscriber: Skizzerz.