Last modified: 2014-03-01 11:08:02 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 T51523, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 49523 - Can not delete image (Postgres)
Can not delete image (Postgres)
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Database (Other open bugs)
1.22.0
PC Linux
: High major with 2 votes (vote)
: 1.22.x release
Assigned To: Nobody - You can work on this!
:
: 56174 (view as bug list)
Depends on: 47055
Blocks: postgres
  Show dependency treegraph
 
Reported: 2013-06-13 10:22 UTC by Medik
Modified: 2014-03-01 11:08 UTC (History)
15 users (show)

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


Attachments

Description Medik 2013-06-13 10:22:22 UTC

    
Comment 1 Medik 2013-06-13 10:27:37 UTC
1) Special pages
2) File list
3) Choose one of images
4) delete all
5) Submit (delete)


Database error
 Jump to: navigation, search 
A database query syntax error has occurred. This may indicate a bug in the software. The last attempted database query was: 
SELECT rev_id,rev_page,rev_text_id,rev_timestamp,rev_comment,rev_user_text,rev_user,rev_minor_edit,rev_deleted,rev_len,rev_parent_id,rev_sha1,rev_content_format,rev_content_model,page_namespace,page_title,page_id,page_latest,page_is_redirect,page_len,user_name FROM "revision" INNER JOIN "page" ON ((page_id = rev_page)) LEFT JOIN "mwuser" ON ((rev_user != 0) AND (user_id = rev_user)) WHERE page_id = '10' AND rev_id = '44' LIMIT 1 FOR UPDATE
 from within function "Revision::fetchFromConds". Database returned error "0A000: ERROR: SELECT FOR UPDATE/SHARE cannot be applied to the nullable side of an outer join ".

Backtrace:

#0 /var/www/ideas/includes/db/DatabasePostgres.php(482): DatabaseBase->reportQueryError('ERROR: SELECT ...', '0A000', 'SELECT rev_id,...', 'Revision::fetch...', false)
 #1 /var/www/ideas/includes/db/Database.php(983): DatabasePostgres->reportQueryError('ERROR: SELECT ...', '0A000', 'SELECT rev_id,...', 'Revision::fetch...', false)
 #2 /var/www/ideas/includes/db/Database.php(1434): DatabaseBase->query('SELECT rev_id,...', 'Revision::fetch...')
 #3 /var/www/ideas/includes/Revision.php(372): DatabaseBase->select(Array, Array, Array, 'Revision::fetch...', Array, Array)
 #4 /var/www/ideas/includes/Revision.php(314): Revision::fetchFromConds(Object(DatabasePostgres), Array, 3)
 #5 /var/www/ideas/includes/Revision.php(294): Revision::loadFromConds(Object(DatabasePostgres), Array, 3)
 #6 /var/www/ideas/includes/Revision.php(143): Revision::newFromConds(Array, 3)
 #7 /var/www/ideas/includes/WikiPage.php(575): Revision::newFromPageId(10, 44, 3)
 #8 /var/www/ideas/includes/WikiPage.php(615): WikiPage->loadLastEdit()
 #9 /var/www/ideas/includes/WikiPage.php(2543): WikiPage->getContent(3)
 #10 /var/www/ideas/includes/FileDeleteForm.php(185): WikiPage->doDeleteArticleReal('', false, 0, false, '', Object(User))
 #11 /var/www/ideas/includes/FileDeleteForm.php(110): FileDeleteForm::doDelete(Object(Title), Object(LocalFile), '', '', false, Object(User))
 #12 /var/www/ideas/includes/ImagePage.php(875): FileDeleteForm->execute()
 #13 /var/www/ideas/includes/actions/DeleteAction.php(45): ImagePage->delete()
 #14 /var/www/ideas/includes/Wiki.php(439): DeleteAction->show()
 #15 /var/www/ideas/includes/Wiki.php(305): MediaWiki->performAction(Object(ImagePage), Object(Title))
 #16 /var/www/ideas/includes/Wiki.php(565): MediaWiki->performRequest()
 #17 /var/www/ideas/includes/Wiki.php(458): MediaWiki->main()
 #18 /var/www/ideas/index.php(59): MediaWiki->run()
 #19 {main}

Apache/2.2.16 (Debian)
Linux 2.6.32-5-amd64
PHP Version 5.3.10-1
PostgreSQL 9.1.2
Comment 2 gparent 2013-06-25 15:34:28 UTC
Getting the same issue here with a stock 1.21.1 install on PostgreSQL.
Comment 3 Marcin Cieślak 2013-10-15 23:31:19 UTC
Could replicate locally in the current git master (1cb9da7a149166a5bbb8c07bf4a415882f716160)
Comment 4 Marcin Cieślak 2013-10-25 18:56:12 UTC
*** Bug 56174 has been marked as a duplicate of this bug. ***
Comment 5 btiqui 2013-10-29 19:52:33 UTC
Same error (see below) for 1.21.2 install with PostgreSQL database.

Database errorJump to: navigation, search 
A database query syntax error has occurred. This may indicate a bug in the software. The last attempted database query was: 
SELECT rev_id,rev_page,rev_text_id,rev_timestamp,rev_comment,rev_user_text,rev_user,rev_minor_edit,rev_deleted,rev_len,rev_parent_id,rev_sha1,rev_content_format,rev_content_model,page_namespace,page_title,page_id,page_latest,page_is_redirect,page_len,user_name FROM "revision" INNER JOIN "page" ON ((page_id = rev_page)) LEFT JOIN "mwuser" ON ((rev_user != 0) AND (user_id = rev_user)) WHERE page_id = '14' AND rev_id = '60' LIMIT 1 FOR UPDATE
from within function "Revision::fetchFromConds". Database returned error "0A000: ERROR: SELECT FOR UPDATE/SHARE cannot be applied to the nullable side of an outer join ".
Comment 6 Mark A. Hershberger 2013-11-25 19:49:49 UTC
Since this is showing up in 1.21, I don't think we need to delay 1.22 for this.  But this should be fixed ASAP.
Comment 7 Nemo 2013-12-30 09:29:27 UTC
Update per https://www.mediawiki.org/w/index.php?title=MediaWiki_1.22/Known_issues&oldid=847749 which seems to be the master list.
Comment 8 Martin 2014-01-27 04:26:16 UTC
I can confirm this bug is happening in 1.22.1.

I was getting the same error above when enabling showing SQL errors in the browser. But when I look into my postgresql log in Linux, I see the following:

<code>
2014-01-27 04:21:19 UTC ERROR:  column "rev_id" does not exist at character 49
2014-01-27 04:21:19 UTC STATEMENT:  SELECT /* Revision::fetchFromConds Mkonecny */  rev_id,rev_page,rev_text_id,rev_timestamp,rev_comment,rev_user_text,rev_user,rev_minor_edit,rev_deleted,rev_len,rev_parent_id,rev_sha1,rev_content_format,rev_content_model,page_namespace,page_title,page_id,page_latest,page_is_redirect,page_len,user_name  FROM "mwuser"   WHERE page_id = '10' AND rev_id = '280'  LIMIT 1   FOR UPDATE OF page
</code>

1.22.0 was a fresh install (first time I ever used mediawiki). I upgraded to 1.22.1 in an attempt to solve this problem (which it obviously didn't).
Comment 9 Lethosor 2014-01-27 15:28:24 UTC
That's really strange. It looks like it's trying to delete a page from the _user_ table (and failing, obviously, since the user table has none of the columns specified). I can confirm this with a clean install of 1.22.1 with PostgreSQL, although it's strange because it doesn't happen with MySQL (I don't see any reason why the table name would change based on the database system in use, particularly the revision table).
Comment 10 Martin 2014-01-27 19:53:33 UTC
I definitely don't have those columns:

wikidocs=# \d mediawiki.mwuser
                                                Table "mediawiki.mwuser"
          Column          |           Type           |                            Modifiers                             
--------------------------+--------------------------+------------------------------------------------------------------
 user_id                  | integer                  | not null default nextval('mediawiki.user_user_id_seq'::regclass)
 user_name                | text                     | not null
 user_real_name           | text                     | 
 user_password            | text                     | 
 user_newpassword         | text                     | 
 user_newpass_time        | timestamp with time zone | 
 user_token               | text                     | 
 user_email               | text                     | 
 user_email_token         | text                     | 
 user_email_token_expires | timestamp with time zone | 
 user_email_authenticated | timestamp with time zone | 
 user_touched             | timestamp with time zone | 
 user_registration        | timestamp with time zone | 
 user_editcount           | integer                  | 
Indexes:
    "mwuser_pkey" PRIMARY KEY, btree (user_id)
    "mwuser_user_name_key" UNIQUE CONSTRAINT, btree (user_name)
    "user_email_token_idx" btree (user_email_token)
Referenced by:
    TABLE "mediawiki.archive" CONSTRAINT "archive_ar_user_fkey" FOREIGN KEY (ar_user) REFERENCES mediawiki.mwuser(user_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED
    TABLE "mediawiki.filearchive" CONSTRAINT "filearchive_fa_deleted_user_fkey" FOREIGN KEY (fa_deleted_user) REFERENCES mediawiki.mwuser(user_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED
    TABLE "mediawiki.filearchive" CONSTRAINT "filearchive_fa_user_fkey" FOREIGN KEY (fa_user) REFERENCES mediawiki.mwuser(user_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED
    TABLE "mediawiki.image" CONSTRAINT "image_img_user_fkey" FOREIGN KEY (img_user) REFERENCES mediawiki.mwuser(user_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED
    TABLE "mediawiki.ipblocks" CONSTRAINT "ipblocks_ipb_by_fkey" FOREIGN KEY (ipb_by) REFERENCES mediawiki.mwuser(user_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED
    TABLE "mediawiki.ipblocks" CONSTRAINT "ipblocks_ipb_user_fkey" FOREIGN KEY (ipb_user) REFERENCES mediawiki.mwuser(user_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED
    TABLE "mediawiki.logging" CONSTRAINT "logging_log_user_fkey" FOREIGN KEY (log_user) REFERENCES mediawiki.mwuser(user_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED
    TABLE "mediawiki.oldimage" CONSTRAINT "oldimage_oi_user_fkey" FOREIGN KEY (oi_user) REFERENCES mediawiki.mwuser(user_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED
    TABLE "mediawiki.protected_titles" CONSTRAINT "protected_titles_pt_user_fkey" FOREIGN KEY (pt_user) REFERENCES mediawiki.mwuser(user_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED
    TABLE "mediawiki.recentchanges" CONSTRAINT "recentchanges_rc_user_fkey" FOREIGN KEY (rc_user) REFERENCES mediawiki.mwuser(user_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED
    TABLE "mediawiki.revision" CONSTRAINT "revision_rev_user_fkey" FOREIGN KEY (rev_user) REFERENCES mediawiki.mwuser(user_id) ON DELETE RESTRICT DEFERRABLE INITIALLY DEFERRED
    TABLE "mediawiki.user_former_groups" CONSTRAINT "user_former_groups_ufg_user_fkey" FOREIGN KEY (ufg_user) REFERENCES mediawiki.mwuser(user_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED
    TABLE "mediawiki.user_groups" CONSTRAINT "user_groups_ug_user_fkey" FOREIGN KEY (ug_user) REFERENCES mediawiki.mwuser(user_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED
    TABLE "mediawiki.user_newtalk" CONSTRAINT "user_newtalk_user_id_fkey" FOREIGN KEY (user_id) REFERENCES mediawiki.mwuser(user_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED
    TABLE "mediawiki.user_properties" CONSTRAINT "user_properties_up_user_fkey" FOREIGN KEY (up_user) REFERENCES mediawiki.mwuser(user_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED
    TABLE "mediawiki.watchlist" CONSTRAINT "watchlist_wl_user_fkey" FOREIGN KEY (wl_user) REFERENCES mediawiki.mwuser(user_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED
Comment 11 Umherirrender 2014-01-28 17:06:47 UTC
Sounds like a duplicate of fixed bug 47055, because there also the FOR UPDATE was a problem.
Comment 12 Martin 2014-01-28 17:24:37 UTC
@Umherirrender

I saw that ticket (bug 47055) and thought the same thing. Unfortunately 1.22.1 does not address this problem.

IMO there's something wrong with the 1.22.0 installer for Postgresql seeing as the tables generated during install do not have the required columns.
Comment 13 Umherirrender 2014-01-28 18:03:41 UTC
The rev_id column is part of the revision table, but the join to that table is missing (sql example in comment 5 has it), which should be there, but the missing join condition in the sql of comment 8 sounds more like bug 60031 or is a problem with the FOR UPDATE fix, see bug 60531. I have no postgres to test this.
Comment 14 Martin 2014-01-28 18:14:34 UTC
I can confirm bug 60531 represents the issue, manually applying the patch in that ticket (https://gerrit.wikimedia.org/r/109914) solved the issue.
Comment 15 Umherirrender 2014-02-03 20:02:21 UTC
The sql error of comment 0 should be fixed with bug 47055, needs testing.
Comment 16 db [inactive,noenotif] 2014-03-01 11:08:02 UTC
Works now

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


Navigation
Links