Last modified: 2010-05-15 15:48:31 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 9417 - Unable to upload new versions of images with PostgreSQL
Unable to upload new versions of images with PostgreSQL
Product: MediaWiki
Classification: Unclassified
Database (Other open bugs)
PC All
: Normal normal with 2 votes (vote)
: ---
Assigned To: Nobody - You can work on this!
Depends on:
Blocks: postgres
  Show dependency treegraph
Reported: 2007-03-26 08:41 UTC by Olleg Samoylov
Modified: 2010-05-15 15:48 UTC (History)
0 users

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


Description Olleg Samoylov 2007-03-26 08:41:01 UTC
*  MediaWiki: 1.9.3
    * PHP: 5.2.0-8+etch1 (apache2handler)
    * PostgreSQL: PostgreSQL 8.1.8 on x86_64-pc-linux-gnu, compiled by GCC cc
(GCC) 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)

When I try to upload new version of image I get in html:

Warning: pg_query() []: Query failed: ERROR: duplicate key
violates unique constraint "image_pkey" in
/usr/share/mediawiki1.9/includes/DatabasePostgres.php on line 389

Warning: pg_affected_rows(): supplied argument is not a valid PostgreSQL result
resource in /usr/share/mediawiki1.9/includes/DatabasePostgres.php on line 454

And in database log:

2007-03-26 12:32:36 MSD ERROR:  duplicate key violates unique constraint
2007-03-26 12:32:36 MSD STATEMENT:  INSERT /* Image::recordUpload */  INTO image
) VALUES ('History1.jpg','128756','1056','1426','8','BITMAP','image','jpeg','200
7-03-26 08:32:36 GMT','','2','Olleg','a:0:{}')
Comment 1 Greg Sabino Mullane 2007-04-05 21:39:21 UTC
Rather than checking for existence, the software simply tries an insert. If that
fails, it does an update. Looking into an elegant workaround.
Comment 2 Olleg Samoylov 2007-04-06 07:26:28 UTC
lock table (to avoid concurrent insertion)
try to update if updated 0 then insert
Comment 3 Brion Vibber 2007-04-06 18:47:17 UTC
Looks like the DatabasePostgres class is not honoring INSERT IGNORE;
you need to fix that or various other things are going to die as well.
Comment 4 Greg Sabino Mullane 2007-05-15 02:59:48 UTC
Fixed in r22178.

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