Last modified: 2012-08-04 20:48:38 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 T13331, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 11331 - some Functions don't Work with PostgreSQL
some Functions don't Work with PostgreSQL
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Database (Other open bugs)
1.11.x
PC Windows Server 2003
: Normal major (vote)
: ---
Assigned To: Nobody - You can work on this!
:
: 11992 (view as bug list)
Depends on:
Blocks: postgres
  Show dependency treegraph
 
Reported: 2007-09-14 08:56 UTC by Norbert Kaiser
Modified: 2012-08-04 20:48 UTC (History)
3 users (show)

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


Attachments

Description Norbert Kaiser 2007-09-14 08:56:40 UTC
Hello,

I have updated my Mediawiki from Version 1.8.4 to 1.11.0(German-language). My PostgreSQL Version is 8.2 (Windows-Version).
Now don't work some functions.

1. Upload - Function concat und function  If do not exists in pg/plSQL

"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. "

I wrote and install this function. now ist works for me 

2. Compare Versions

"A database error has occurred Query: SELECT * FROM recentchanges WHERE rc_timestamp = '20070912111612' AND rc_this_oldid = '1693' AND rc_last_oldid = '1692' AND rc_patrolled = '0' Function: DifferenceEngine::showDiffPage Error: 1 ERROR: invalid input syntax for type timestamp with time zone: "20070912111612" 

Backtrace:

#0 C:\Programme\Apache Group\Apache2\htdocs\wiki\includes\Database.php(779): DatabasePostgres->reportQueryError('ERROR: invalid...', 1, 'SELECT * FROM...', 'DifferenceEngin...', false)
#1 C:\Programme\Apache Group\Apache2\htdocs\wiki\includes\Database.php(1224): Database->query('SELECT * FROM...', 'DifferenceEngin...')
#2 C:\Programme\Apache Group\Apache2\htdocs\wiki\includes\RecentChange.php(100): Database->select('recentchanges', '*', Array, 'DifferenceEngin...')"

What can I do?

Thanks

Norbert
Comment 1 Greg Sabino Mullane 2007-09-17 03:13:21 UTC
The second error was just recently fixed (see r25696), I'll look into the first one. looks like LocalFile.php has some mysql-specific code in it.
Comment 2 Norbert Kaiser 2007-09-17 09:17:44 UTC
Thank you, Compare Versions works now!
Comment 3 Norbert Kaiser 2007-09-18 15:52:00 UTC
a new one, when i try to delete a file

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')),'2','2007-09-18 15:48:58 GMT','doppelt',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 = 'Shifkey_uebeblick.JPG' Function: LocalFileDeleteBatch::doDBInserts Error: 1 ERROR: smallint out of range 

Backtrace:

#0 C:\Programme\Apache Group\Apache2\htdocs\wiki\includes\Database.php(779): DatabasePostgres->reportQueryError('ERROR: smallin...', 1, 'INSERT INTO fi...', 'LocalFileDelete...', false)
#1 C:\Programme\Apache Group\Apache2\htdocs\wiki\includes\Database.php(1845): Database->query('INSERT INTO fi...', 'LocalFileDelete...')
#2 C:\Programme\Apache Group\Apache2\htdocs\wiki\includes\filerepo\LocalFile.php(1216): Database->insertSelect('filearchive', 'image', Array, Array, 'LocalFileDelete...')
#3 C:\Programme\Apache Group\Apache2\htdocs\wiki\includes\filerepo\LocalFile.php(1297): LocalFileDeleteBatch->doDBInserts()
#4 C:\Programme\Apache Group\Apache2\htdocs\wiki\includes\filerepo\LocalFile.php(873): LocalFileDeleteBatch->execute()
#5 C:\Programme\Apache Group\Apache2\htdocs\wiki\includes\FileDeleteForm.php(75): LocalFile->delete('doppelt')
#6 C:\Programme\Apache Group\Apache2\htdocs\wiki\includes\ImagePage.php(491): FileDeleteForm->execute()
#7 C:\Programme\Apache Group\Apache2\htdocs\wiki\includes\Wiki.php(397): ImagePage->delete()
#8 C:\Programme\Apache Group\Apache2\htdocs\wiki\includes\Wiki.php(48): MediaWiki->performAction(Object(OutputPage), Object(ImagePage), Object(Title), Object(User), Object(WebRequest))
#9 C:\Programme\Apache Group\Apache2\htdocs\wiki\index.php(89): MediaWiki->initialize(Object(Title), Object(OutputPage), Object(User), Object(WebRequest))
#10 {main}
Comment 4 Greg Sabino Mullane 2007-09-23 22:24:09 UTC
Made a bunch of other changes in r26043 that should fix the other problems.
Comment 5 wikilexw 2007-10-10 08:50:02 UTC
(In reply to comment #4)
> Made a bunch of other changes in r26043 that should fix the other problems.
> 

Can anybody tell me what commands must be issued in psql to have this fix work for an 1.11.0 installation? I understand that I have to use the changed php and inc files as listen in the revision, but since the database structure seems to be changed too, this will probably not be enough.

And since I'm totally ignorant about psql (I'm p[robably not the only one), it would be helpful if the manual commands to change the database structure would be listed here as well.

tnx
Comment 6 Greg Sabino Mullane 2007-10-10 13:06:01 UTC
Running "php update.php" inside the maintenance directory will always 
bring your schema up to date.
Comment 7 wikilexw 2007-10-10 14:56:38 UTC
Too bad...

If I run update.php, I get (at the end of the script) the error:
[code]
PHP Warning:  fopen(..../wiki/maintenance/postgres/archives/patch-ts2pagetitle.sql): failed to open stream: No such file or directory in ..../wiki/includes/Database.php on line 2200
Could not open "..../wiki/maintenance/postgres/archives/patch-ts2pagetitle.sql".
[/code]

I removed patch-ts2pagetitle.sql out of updaters.inc and re-ran the script. It now successfully finishes.
But the delete functionality in the wiki is still not okay: I now get the same error as Norbert in comment #3.
Should I download additional files next to those mentioned in r26043 or what?
Comment 8 Greg Sabino Mullane 2007-10-10 15:06:12 UTC
Yes, at the minimum you should download those files. Ideally, you should do an svn up to get all of the latest fixes, and then try running update.php again.
Comment 9 wikilexw 2007-10-11 07:09:29 UTC
Did an svn update, ran update.php, and still (when trying to delete an image):

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',CASE WHEN img_sha1='' THEN '' ELSE img_sha1 || '.gif' END,'1','2007-10-11 07:07:26 GMT','test deletion',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 = 'Tag_policy.gif' Function: LocalFileDeleteBatch::doDBInserts Error: 1 ERROR: smallint out of range

Backtrace:

#0 ..../wiki/includes/Database.php(796): DatabasePostgres->reportQueryError('ERROR: smallin...', 1, 'INSERT INTO fi...', 'LocalFileDelete...', false)
#1 ..../wiki/includes/Database.php(1862): Database->query('INSERT INTO fi...', 'LocalFileDelete...')
#2 ..../wiki/includes/filerepo/LocalFile.php(1216): Database->insertSelect('filearchive', 'image', Array, Array, 'LocalFileDelete...')
#3 ..../wiki/includes/filerepo/LocalFile.php(1296): LocalFileDeleteBatch->doDBInserts()
#4 ..../wiki/includes/filerepo/LocalFile.php(873): LocalFileDeleteBatch->execute()
#5 ..../wiki/includes/FileDeleteForm.php(75): LocalFile->delete('test deletion')
#6 ..../wiki/includes/ImagePage.php(493): FileDeleteForm->execute()
#7 ..../wiki/includes/Wiki.php(397): ImagePage->delete()
#8 ..../wiki/includes/Wiki.php(48): MediaWiki->performAction(Object(OutputPage), Object(ImagePage), Object(Title), Object(User), Object(WebRequest))
#9 ..../wiki/index.php(89): MediaWiki->initialize(Object(Title), Object(OutputPage), Object(User), Object(WebRequest))
#10 ..../wiki/index.php5(1): require('/srv/www/htdocs...')
#11 {main}
Comment 10 Greg Sabino Mullane 2007-10-12 00:41:58 UTC
Okay, I think it may be the fa_height and fa_width columns causing the troubles. I just commited r26618 which should update those columns for you when you run update.php.

Comment 11 wikilexw 2007-10-12 10:03:07 UTC
We're coming closer, but it's not yet it, Greg...
And by the way, much appreciated that you spend yor time to this issue!

I did a svn checkout:

# svn checkout http://svn.wikimedia.org/svnroot/mediawiki/branches/REL1_11/phase3
Checked out revision 26625.

Then ran update:

# cd phase3/maintenance
# php5 update.php

MediaWiki 1.11.0 Updater

Going to run database updates for wiki
Depending on the size of your database this may take a while!
Abort with control-c in the next five seconds...0
... search_path for user "wiki" looks correct (mediawiki, public)
... default value of "client_min_messages" is correctly set to "error" for user "wiki"

<deleted some uninteresting stuff>

... column "revision.rev_len" already exists
Changing column type of "archive.ar_deleted" from "int2" to "smallint"
Changing column type of "filearchive.fa_deleted" from "int2" to "smallint"
Changing column type of "filearchive.fa_height" from "int4" to "integer"
... column "filearchive.fa_metadata" is already of type "bytea"
Changing column type of "filearchive.fa_size" from "int4" to "integer"
Changing column type of "filearchive.fa_width" from "int4" to "integer"
... column "filearchive.fa_storage_group" is already of type "text"
... column "filearchive.fa_storage_key" is already of type "text"
... column "image.img_metadata" is already of type "bytea"
Changing column type of "image.img_size" from "int4" to "integer"
Changing column type of "image.img_width" from "int4" to "integer"
Changing column type of "image.img_height" from "int4" to "integer"
... column "ipblocks.ipb_address" is already of type "text"
Changing column type of "ipblocks.ipb_deleted" from "bpchar" to "char"
... column "math.math_inputhash" is already of type "bytea"
... column "math.math_outputhash" is already of type "bytea"
... column "mwuser.user_token" is already of type "text"
... column "mwuser.user_email_token" is already of type "text"
... column "objectcache.keyname" is already of type "text"
Changing column type of "oldimage.oi_height" from "int4" to "integer"
Changing column type of "oldimage.oi_size" from "int4" to "integer"
Changing column type of "oldimage.oi_width" from "int4" to "integer"
Changing column type of "querycache.qc_value" from "int4" to "integer"
Changing column type of "querycachetwo.qcc_value" from "int4" to "integer"
Changing column type of "recentchanges.rc_deleted" from "int2" to "smallint"
Changing column type of "templatelinks.tl_namespace" from "int2" to "smallint"
... column "user_newtalk.user_ip" is already of type "text"
Changing "oldimage.oi_deleted" to type "smallint"
... index "archive_user_text" on table "archive" already exists
... index "img_sha1" on table "image" already exists
... index "oi_sha1" on table "oldimage" already exists
... index "rev_text_id_idx" on table "revision" already exists
PHP Fatal error:  Call to undefined method DatabasePostgres::hasConstraint() in /srv/www/htdocs/wiki/phase3/maintenance/updaters.inc on line 1505


As you can see, the update process terminates with an error. If I now try to delete an image, I don't get a database error anymore; instead I get an error message on a wiki page:

Errors were encountered while deleting the file:
    * Could not create directory "deleted/0/3/k".
    * Could not create directory "deleted/7/p/i". 

And the image still exists.

Tried the 1.12alpha version: still problems deleting images. Rolled back to 1.11 including r26625, but now I have more problems regarding images: some don't load anymore, there is a gray rectangle showing the message "Error creating thumbnail: Unable to create destination directory".  :-(


Oh wel, maybe I have to convince my boss that we really should run on MySql... After all, that's the database that MediaWiki was intended to use in the first place.
Comment 12 wikilexw 2007-10-12 10:12:38 UTC
Well, that last remark was too fast...
The solution to the problem was in fact rather easy. Changing the owner right of the directory "deleted" under wiki/images resolved the "could not create" error (which I should have thought of in the first place, of course...).

Re-uploading the images also solved the grey rectangle in some way...

So: for me, this issue is now solved. But you might want to look into the error message of the update process ("undefined method DatabasePostgres::hasConstraint()"). 

Thanks a bundle, Greg!
Comment 13 Greg Sabino Mullane 2007-10-12 13:11:55 UTC
Looks like you have not updated DatabasePostgres.php, due to this:
"Call to undefined method DatabasePostgres::hasConstraint()"

Make sure that file is up to date and update.php should work better.
Comment 14 wikilexw 2007-10-12 15:03:37 UTC
If I do a checkout like this:

# svn checkout
http://svn.wikimedia.org/svnroot/mediawiki/branches/REL1_11/phase3

I should have the latest version, shouldn't I?
Comment 15 Greg Sabino Mullane 2007-10-12 15:12:00 UTC
Not quite: try replacing "branches/REL1_11" with "trunk"
Comment 16 Greg Sabino Mullane 2007-10-15 21:02:54 UTC
For completeness, the manual way to fix the smallint errors seen above is:

ALTER TABLE filearchive ALTER fa_width TYPE INT;
ALTER TABLE filearchive ALTER fa_height TYPE INT;
Comment 17 wikilexw 2007-10-16 10:06:39 UTC
Well yes, I meant "the latest version oif the 1.11 branch"...
Thanks anyway, Greg.
Comment 18 wikilexw 2007-11-16 10:46:53 UTC
*** Bug 11992 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