Page MenuHomePhabricator

Can't commit edits to Postgres because relation "text_old_id_seq" does not exist?
Closed, ResolvedPublic

Description

Author: niels.olson

Description:
I can't seem to commit any transactions to the database. The backtrace is below. Postgres IRC member oicu said

"You might be able to cure it with something like "create sequence text_old_id_seq" if you're lucky. You'll also need to grant select and update privs on that sequence appropriately."

Any thoughts on this? Am I in a situation where this is a database that needs a growing pile of transactions rolled back, or is there something in mediawiki's transaction code that's jamming up postgres each time? FWIW, I ran VACUUM on tables as recommended by pgAdmin3 and I still get the same traceback.


Warning: pg_query(): Query failed: ERROR: relation "text_old_id_seq" does not exist in /opt/local/apache2/htdocs/w/includes/db/DatabasePostgres.php on line 580 Warning: pg_query(): Query failed: ERROR: current transaction is aborted, commands ignored until end of transaction block in /opt/local/apache2/htdocs/w/includes/db/DatabasePostgres.php on line 580 Warning: pg_query(): Query failed: ERROR: current transaction is aborted, commands ignored until end of transaction block in /opt/local/apache2/htdocs/w/includes/db/DatabasePostgres.php on line 580 Warning: pg_query(): Query failed: ERROR: current transaction is aborted, commands ignored until end of transaction block in /opt/local/apache2/htdocs/w/includes/db/DatabasePostgres.php on line 580 Warning: pg_query(): Query failed: ERROR: current transaction is aborted, commands ignored until end of transaction block in /opt/local/apache2/htdocs/w/includes/db/DatabasePostgres.php on line 580 Warning: Invalid argument supplied for foreach() in /opt/local/apache2/htdocs/w/includes/SpecialPage.php on line 603 Warning: Invalid argument supplied for foreach() in /opt/local/apache2/htdocs/w/includes/SpecialPage.php on line 603 Warning: pg_query(): Query failed: ERROR: current transaction is aborted, commands ignored until end of transaction block in /opt/local/apache2/htdocs/w/includes/db/DatabasePostgres.php on line 580 Warning: pg_query(): Query failed: ERROR: current transaction is aborted, commands ignored until end of transaction block in /opt/local/apache2/htdocs/w/includes/db/DatabasePostgres.php on line 580 Warning: pg_query(): Query failed: ERROR: current transaction is aborted, commands ignored until end of transaction block in /opt/local/apache2/htdocs/w/includes/db/DatabasePostgres.php on line 580 Warning: pg_query(): Query failed: ERROR: current transaction is aborted, commands ignored until end of transaction block in /opt/local/apache2/htdocs/w/includes/db/DatabasePostgres.php on line 580 Warning: pg_query(): Query failed: ERROR: current transaction is aborted, commands ignored until end of transaction block in /opt/local/apache2/htdocs/w/includes/db/DatabasePostgres.php on line 580 Warning: Invalid argument supplied for foreach() in /opt/local/apache2/htdocs/w/includes/SpecialPage.php on line 603 Warning: pg_query(): Query failed: ERROR: current transaction is aborted, commands ignored until end of transaction block in /opt/local/apache2/htdocs/w/includes/db/DatabasePostgres.php on line 580 Warning: Invalid argument supplied for foreach() in /opt/local/apache2/htdocs/w/includes/SpecialPage.php on line 603 Warning: pg_query(): Query failed: ERROR: current transaction is aborted, commands ignored until end of transaction block in /opt/local/apache2/htdocs/w/includes/db/DatabasePostgres.php on line 580 Warning: Invalid argument supplied for foreach() in /opt/local/apache2/htdocs/w/includes/SpecialPage.php on line 603 Warning: pg_query(): Query failed: ERROR: current transaction is aborted, commands ignored until end of transaction block in /opt/local/apache2/htdocs/w/includes/db/DatabasePostgres.php on line 580 Warning: pg_query(): Query failed: ERROR: current transaction is aborted, commands ignored until end of transaction block in /opt/local/apache2/htdocs/w/includes/db/DatabasePostgres.php on line 580 Warning: Invalid argument supplied for foreach() in /opt/local/apache2/htdocs/w/includes/SpecialPage.php on line 603 Warning: pg_query(): Query failed: ERROR: current transaction is aborted, commands ignored until end of transaction block in /opt/local/apache2/htdocs/w/includes/db/DatabasePostgres.php on line 580 Warning: pg_query(): Query failed: ERROR: current transaction is aborted, commands ignored until end of transaction block in /opt/local/apache2/htdocs/w/includes/db/DatabasePostgres.php on line 580 Warning: Invalid argument supplied for foreach() in /opt/local/apache2/htdocs/w/includes/SpecialPage.php on line 603 Warning: pg_query(): Query failed: ERROR: current transaction is aborted, commands ignored until end of transaction block in /opt/local/apache2/htdocs/w/includes/db/DatabasePostgres.php on line 580 Warning: pg_query(): Query failed: ERROR: current transaction is aborted, commands ignored until end of transaction block in /opt/local/apache2/htdocs/w/includes/db/DatabasePostgres.php on line 580 Warning: pg_query(): Query failed: ERROR: current transaction is aborted, commands ignored until end of transaction block in /opt/local/apache2/htdocs/w/includes/db/DatabasePostgres.php on line 580 MediaWiki internal error.

Original exception: exception 'DBUnexpectedError' with message 'A database error has occurred
Query: SELECT nextval('text_old_id_seq')
Function:
Error: 1 ERROR: relation "text_old_id_seq" does not exist
' in /opt/local/apache2/htdocs/w/includes/db/DatabasePostgres.php:1114
Stack trace:
#0 /opt/local/apache2/htdocs/w/includes/db/Database.php(533): DatabasePostgres->reportQueryError('ERROR: relatio...', 1, 'SELECT nextval(...', '', false)
#1 /opt/local/apache2/htdocs/w/includes/db/DatabasePostgres.php(968): DatabaseBase->query('SELECT nextval(...')
#2 /opt/local/apache2/htdocs/w/includes/Revision.php(829): DatabasePostgres->nextSequenceValue('text_old_id_seq')
#3 /opt/local/apache2/htdocs/w/includes/Article.php(1934): Revision->insertOn(Object(DatabasePostgres))
#4 /opt/local/apache2/htdocs/w/includes/Article.php(1765): Article->doEdit('25 kcal/kilo??*...', '', 98)
#5 /opt/local/apache2/htdocs/w/includes/EditPage.php(1065): Article->updateArticle('25 kcal/kilo??*...', '', false, false, false, '')
#6 /opt/local/apache2/htdocs/w/includes/EditPage.php(2541): EditPage->internalAttemptSave(false, false)
#7 /opt/local/apache2/htdocs/w/includes/EditPage.php(470): EditPage->attemptSave()
#8 /opt/local/apache2/htdocs/w/includes/EditPage.php(355): EditPage->edit()
#9 /opt/local/apache2/htdocs/w/extensions/FCKeditor/FCKeditor.body.php(161): EditPage->submit()
#10 [internal function]: FCKeditor_MediaWiki->onCustomEditor(Object(Article), Object(StubUser))
#11 /opt/local/apache2/htdocs/w/includes/Hooks.php(133): call_user_func_array(Array, Array)
#12 /opt/local/apache2/htdocs/w/includes/Wiki.php(533): wfRunHooks('CustomEditor', Array)
#13 /opt/local/apache2/htdocs/w/includes/Wiki.php(70): MediaWiki->performAction(Object(OutputPage), Object(Article), Object(Title), Object(User), Object(WebRequest))
#14 /opt/local/apache2/htdocs/w/index.php(117): MediaWiki->performRequestForTitle(Object(Title), Object(Article), Object(OutputPage), Object(User), Object(WebRequest))
#15 {main}

Exception caught inside exception handler: exception 'DBUnexpectedError' with message 'SQL error: ERROR: current transaction is aborted, commands ignored until end of transaction block' in /opt/local/apache2/htdocs/w/includes/db/DatabasePostgres.php:631
Stack trace:
#0 /opt/local/apache2/htdocs/w/includes/WatchedItem.php(45): DatabasePostgres->numRows(false)
#1 /opt/local/apache2/htdocs/w/includes/User.php(2257): WatchedItem->isWatched()
#2 /opt/local/apache2/htdocs/w/includes/Title.php(1004): User->isWatched(Object(Title))
#3 /opt/local/apache2/htdocs/w/includes/SkinTemplate.php(836): Title->userIsWatching()
#4 /opt/local/apache2/htdocs/w/includes/SkinTemplate.php(471): SkinTemplate->buildContentActionUrls()
#5 /opt/local/apache2/htdocs/w/includes/OutputPage.php(1244): SkinTemplate->outputPage(Object(OutputPage))
#6 /opt/local/apache2/htdocs/w/includes/Exception.php(164): OutputPage->output()
#7 /opt/local/apache2/htdocs/w/includes/Exception.php(191): MWException->reportHTML()
#8 /opt/local/apache2/htdocs/w/includes/Exception.php(289): MWException->report()
#9 /opt/local/apache2/htdocs/w/includes/Exception.php(348): wfReportException(Object(DBUnexpectedError))
#10 [internal function]: wfExceptionHandler(Object(DBUnexpectedError))
#11 {main}


Version: 1.16.x
Severity: major

Details

Reference
bz21386

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, 10:48 PM
bzimport set Reference to bz21386.

niels.olson wrote:

Also, the postgres is from MacPorts, version 8.3.6, and the mediawiki is svn trunk. The error seems to have started with my latest checkout, which had a couple weeks of changes in it (due to being out service range in the middle of the Texas desert with a pack on my back)

niels.olson wrote:

Turns out this was due to mediawiki changing the names of several sequences in the database. Refreshed all with pgAdmin, and everything works again. Wish that had been in the release notes or something. Was it and I'm just not seeing it? If so, where?

I'm not clear on the history of events? What version was it created with, and did the upgrade a couple weeks later give any errors? (the upgrade command that is).

overlordq wrote:

r58262 and r58263

Seems it missed release notes, did you run update? If the updaters didn't update the fields correctly then yes that's likely a bug, but afaik it worked fine during testing.

  • Bug 24738 has been marked as a duplicate of this bug. ***

overlordq wrote:

the update script uses RENAME SEQUENCE which appears to be 8.3+ instead of the more backwards compatible ALTER TABLE RENAME

overlordq wrote:

Should be fixed with r72314 on master.

Not yet merged to the 1.16 branch.

michael.tutty wrote:

The revision referenced above doesn't appear to work properly with my PG 8.1.21. Specifically, the ALTER TABLE <tablename> RENAME <sequencename> TO <newseqname> seems to be written wrong. I was able to get the following to work:

ALTER TABLE rev_rev_id_val RENAME TO revision_rev_id_seq;
ALTER TABLE revision ALTER COLUMN rev_id SET DEFAULT NEXTVAL('revision_rev_id_seq');

ALTER TABLE text_old_id_val RENAME TO text_old_id_seq;
ALTER TABLE pagecontent ALTER COLUMN old_id SET DEFAULT nextval('text_old_id_seq');

ALTER TABLE category_id_seq RENAME TO category_cat_id_seq;
ALTER TABLE category ALTER COLUMN cat_id SET DEFAULT nextval('category_cat_id_seq');

ALTER TABLE ipblocks_ipb_id_val RENAME TO ipblocks_ipb_id_seq;
ALTER TABLE ipblocks ALTER COLUMN ipb_id SET DEFAULT nextval('ipblocks_ipb_id_seq');

ALTER TABLE rc_rc_id_seq RENAME TO recentchanges_rc_id_seq;
ALTER TABLE recentchanges ALTER COLUMN rc_id SET DEFAULT nextval('recentchanges_rc_id_seq');

ALTER TABLE log_log_id_seq RENAME TO logging_log_id_seq;
ALTER TABLE logging ALTER COLUMN log_id SET DEFAULT nextval('logging_log_id_seq');

ALTER TABLE pr_id_val RENAME TO page_restrictions_pr_id_seq;
ALTER TABLE page_restrictions ALTER COLUMN pr_id SET DEFAULT nextval('page_restrictions_pr_id_seq');

Thanks for your report. PostgreSQL 8.1 reached its end of life in November 2010. While MediaWiki 1.16 may have been released before that time, this bug is now a dead horse.

Jdforrester-WMF subscribed.

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