Last modified: 2010-05-15 15:48:31 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 T11417, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 9417 - Unable to upload new versions of images with PostgreSQL
Unable to upload new versions of images with PostgreSQL
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Database (Other open bugs)
1.9.x
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: ---


Attachments

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() [functlion.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
"image_pkey"
2007-03-26 12:32:36 MSD STATEMENT:  INSERT /* Image::recordUpload */  INTO image
(img_name,img_size,img_width,img_height,img_bits,img_media_type,img_major_mime,
img_minor_mime,img_timestamp,img_description,img_user,img_user_text,img_metadata
) 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
commit
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.


Navigation
Links