Last modified: 2010-05-15 15:48:31 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:{}')
Rather than checking for existence, the software simply tries an insert. If that fails, it does an update. Looking into an elegant workaround.
lock table (to avoid concurrent insertion) try to update if updated 0 then insert commit
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.
Fixed in r22178.