Last modified: 2012-08-04 20:49:07 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 T13363, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 11363 - Upload a new version of this file, postgres database error
Upload a new version of this file, postgres database error
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Uploading (Other open bugs)
1.11.x
PC Linux
: Normal major (vote)
: ---
Assigned To: Nobody - You can work on this!
http://wiki.nsdl.org
:
: 12365 13021 13345 (view as bug list)
Depends on:
Blocks: postgres
  Show dependency treegraph
 
Reported: 2007-09-16 15:46 UTC by Elly
Modified: 2012-08-04 20:49 UTC (History)
5 users (show)

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


Attachments

Description Elly 2007-09-16 15:46:12 UTC
* MediaWiki: 1.11.0
* PHP: 5.2.0 (apache2handler)
* PostgreSQL: PostgreSQL 8.2rc1 on x86_64-unknown-linux-gnu, compiled by GCC gcc (GCC) 3.4.6 20060404 (Red Hat 3.4.6-3) 
* Apache 2.0.52

When uploading a new version of the same file (image), get database error.

Internal error
A database error has occurred Query: INSERT INTO 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,'20070915224357!ToolsInteroperability.jpg',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 image WHERE img_name = 'ToolsInteroperability.jpg' Function: LocalFile::recordUpload2 Error: 1 ERROR: column "oi_metadata" is of type bytea but expression is of type text LINE 1: ...,oi_timestamp,oi_description,oi_user,oi_user_text,oi_metadat... ^ HINT: You will need to rewrite or cast the expression. 

Backtrace:

#0 /var/www/html/mediawiki/includes/Database.php(779): DatabasePostgres->reportQueryError('ERROR: column ...', 1, 'INSERT INTO ol...', 'LocalFile::reco...', false)
#1 /var/www/html/mediawiki/includes/Database.php(1845): Database->query('INSERT INTO ol...', 'LocalFile::reco...')
#2 /var/www/html/mediawiki/includes/filerepo/LocalFile.php(746): Database->insertSelect('oldimage', 'image', Array, Array, 'LocalFile::reco...')
#3 /var/www/html/mediawiki/includes/filerepo/LocalFile.php(642): LocalFile->recordUpload2('20070915224357!...', 'Shows the relat...', 'Shows the relat...', Array, false)
#4 /var/www/html/mediawiki/includes/SpecialUpload.php(436): LocalFile->upload('/tmp/phpf93Xho', 'Shows the relat...', 'Shows the relat...', 1, Array)
#5 /var/www/html/mediawiki/includes/SpecialUpload.php(248): UploadForm->processUpload()
#6 /var/www/html/mediawiki/includes/SpecialUpload.php(14): UploadForm->execute()
#7 /var/www/html/mediawiki/includes/SpecialPage.php(653): wfSpecialUpload(NULL, Object(SpecialPage))
#8 /var/www/html/mediawiki/includes/SpecialPage.php(459): SpecialPage->execute(NULL)
#9 /var/www/html/mediawiki/includes/Wiki.php(201): SpecialPage::executePath(Object(Title))
#10 /var/www/html/mediawiki/includes/Wiki.php(45): MediaWiki->initializeSpecialCases(Object(Title), Object(OutputPage), Object(WebRequest))
#11 /var/www/html/mediawiki/index.php(89): MediaWiki->initialize(Object(Title), Object(OutputPage), Object(User), Object(WebRequest))
#12 {main}
Comment 1 Greg Sabino Mullane 2007-09-17 03:07:39 UTC
Probably needs some encodeBlob wrappers around the *_metadata column calls from a quick guess, no time to look into the code right now.
Comment 2 Elly 2007-09-17 19:27:55 UTC
From what we can tell, the problem looks to be related to the fact that the table "image" has a column img.metadata with type "text" and table "oldimage" has a column oi.metadata with type "bytea" and on line 728 in "includes/FileRepo/LocalFile.php" the "$dbw->insertSelect" moves the previous values without casting the column type.  

If we change oldimage.oi_metadata type to "text" in the database manually, the error goes away, but there may be another reason for this table.column type to be bytea that I am not aware of.  This error occurred with upgrade to 1.11.0 after using the "maintenance/update.php" process which used the "maintenance/postgres/tables.sql" file.

Thanks, elly
Comment 3 Greg Sabino Mullane 2007-09-23 20:51:06 UTC
Yes, those should all be bytea at this point. Made the change in r26042. You should now be able to 
run php update.php from the maintenance directory and it will update your schema for you. Or 
just run this manually from psql:

ALTER TABLE image ALTER img_metadata TYPE bytea USING decode(img_metadata,'escape');
ALTER TABLE filearchive ALTER fa_metadata TYPE bytea USING decode(fa_metadata,'escape');
Comment 4 Chris Bandy 2008-01-24 21:06:26 UTC
*** Bug 12365 has been marked as a duplicate of this bug. ***
Comment 5 OverlordQ 2008-02-14 22:12:03 UTC
*** Bug 13021 has been marked as a duplicate of this bug. ***
Comment 6 Alexandre Emsenhuber [IAlex] 2009-02-21 18:38:30 UTC
*** Bug 13345 has been marked as a duplicate of this bug. ***

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


Navigation
Links