Page MenuHomePhabricator

Postgresql: Query failed: ERROR: duplicate key violates unique constraint "image_pkey"
Closed, ResolvedPublic

Description

Author: jtosburn

Description:
Clean setup with Postgresql-8.1.9, php-5.2.2

To reproduce: As a superuser, using Mediawiki, upload an image. Then try to update the image, either by clicking "Upload" again and specifying a file with the same name, or by going to the image's wiki page and clicking on "Upload a new version of the file". The following error is generated:

Warning: pg_query() [function.pg-query]: Query failed: ERROR: duplicate key violates unique constraint "image_pkey" in /var/www/localhost/htdocs/pivotwiki/includes/DatabasePostgres.php on line 381
Internal error

A database error has occurred Query: INSERT 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 ('Logo_blk_on_wht.gif','3801','140','72','8','BITMAP','image','gif','2007-07-17 23:44:17 GMT','','1','Jtosburn','a:0:{}') Function: Image::recordUpload Error: 1 ERROR: duplicate key violates unique constraint "image_pkey"

Backtrace:

#0 /var/www/localhost/htdocs/pivotwiki/includes/Database.php(651): DatabasePostgres->reportQueryError('ERROR: duplica...', 1, 'INSERT INTO im...', 'Image::recordUp...', false)
#1 /var/www/localhost/htdocs/pivotwiki/includes/Database.php(1251): Database->query('INSERT INTO im...', 'Image::recordUp...')
#2 /var/www/localhost/htdocs/pivotwiki/includes/DatabasePostgres.php(498): Database->insert('image', Array, 'Image::recordUp...', Array)
#3 /var/www/localhost/htdocs/pivotwiki/includes/Image.php(1605): DatabasePostgres->insert('image', Array, 'Image::recordUp...', 'IGNORE')
#4 /var/www/localhost/htdocs/pivotwiki/includes/SpecialUpload.php(434): Image->recordUpload('20070717234417!...', '', '', '', '', false)
#5 /var/www/localhost/htdocs/pivotwiki/includes/SpecialUpload.php(234): UploadForm->processUpload()
#6 /var/www/localhost/htdocs/pivotwiki/includes/SpecialUpload.php(15): UploadForm->execute()
#7 /var/www/localhost/htdocs/pivotwiki/includes/SpecialPage.php(522): wfSpecialUpload(NULL, Object(SpecialPage))
#8 /var/www/localhost/htdocs/pivotwiki/includes/SpecialPage.php(391): SpecialPage->execute(NULL)
#9 /var/www/localhost/htdocs/pivotwiki/includes/Wiki.php(156): SpecialPage::executePath(Object(Title))
#10 /var/www/localhost/htdocs/pivotwiki/includes/Wiki.php(47): MediaWiki->initializeSpecialCases(Object(Title), Object(OutputPage), Object(WebRequest))
#11 /var/www/localhost/htdocs/pivotwiki/index.php(47): MediaWiki->initialize(Object(Title), Object(OutputPage), Object(User), Object(WebRequest))
#12 {main}


Version: 1.8.x
Severity: normal
OS: Linux

Details

Reference
bz10620

Related Objects

View Standalone Graph
This task is connected to more than 200 other tasks. Only direct parents and subtasks are shown here. Use View Standalone Graph to show more of the graph.

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 9:53 PM
bzimport set Reference to bz10620.
bzimport added a subscriber: Unknown Object (MLST).

Fairly sure this has been fixed already in newer versions: please try out 1.10 and see if the problem still occurs.

jtosburn wrote:

Indeed, you are correct; 1.10 does not exhibit this behavior. Perhaps my bugzilla search skills need work. Thanks very much for your quick response, and my apologies for wasting your time. I'll post a bug in my distro's (Gentoo) bugzilla advocating moving 1.10 to stable status.

Jdforrester-WMF subscribed.

Migrating from the old tracking task to a tag for PostgreSQL-related tasks.