Page MenuHomePhabricator

patch-reference_wiki.sql patch does not handle database prefix
Closed, ResolvedPublic


Adding ref_src_wiki field to table flow_wiki_ref ...[Tue Dec 15 07:50:24 2015] [hphp] [7762:7ff3e8919c80:0:000001] [] 
Fatal error: Uncaught exception 'DBQueryError' with message 'A database error has occurred. Did you forget to run maintenance/update.php after upgrading?  See:
Query: UPDATE `bw_flow_wiki_ref`, `bw_flow_workflow`
 SET flow_wiki_ref.ref_src_wiki = flow_workflow.workflow_wiki
 flow_wiki_ref.ref_src_workflow_id = flow_workflow.workflow_id

Function: DatabaseBase::sourceFile( /www/ )
Error: 1054 Unknown column 'flow_wiki_ref.ref_src_wiki' in 'field list' (
' in /www/
Stack trace:
#0 /www/ DatabaseBase->reportQueryError()
#1 /www/ DatabaseBase->query()
#2 /www/ DatabaseBase->sourceStream()
#3 /www/ DatabaseBase->sourceFile()
#4 /www/ DatabaseUpdater->applyPatch()
#5 /www/ DatabaseUpdater->addField()
#6 /www/ DatabaseUpdater->runUpdates()
#7 /www/ DatabaseUpdater->doUpdates()
#8 /www/ UpdateMediaWiki->execute()
#9 /www/ include()
#10 {main}

Even more mysteriously on next run of update.php claims

...have ref_src_wiki field in flow_wiki_ref table.

which sounds like my wiki will be silently corrupted now.

Event Timeline

Nikerabbit raised the priority of this task from to Needs Triage.
Nikerabbit updated the task description. (Show Details)
Nikerabbit added a subscriber: Nikerabbit.
Restricted Application added subscribers: StudiesWorld, Aklapper. · View Herald Transcript

Change 259234 had a related patch set uploaded (by Matthias Mullie):
Make patch-reference_wiki*.sql work with prefixed tables

New patch waiting in gerrit.

Looking at the db patch, all you'll have to do to uncorrupt your wiki is remove column ref_src_wiki.flow_wiki_ref, then run the script again (once merged)

Change 259234 merged by jenkins-bot:
Make patch-reference_wiki*.sql work with prefixed tables

New error introduced in the patch:

A database query error has occurred.
Query: DROP INDEX IF EXISTS flow_wiki_ref_idx ON `bw_flow_wiki_ref`
Error: 1064 You have an error in your SQL syntax
Nemo_bis reopened this task as Open.EditedDec 16 2015, 8:54 AM
Nemo_bis added a subscriber: Nemo_bis.

DROP INDEX is a PostgreSQL language extension. There are no provisions for indexes in the SQL standard.

The IF EXISTS clause was added in MariaDB 10.1.4

Can we use a more standard way?

Change 259477 had a related patch set uploaded (by Matthias Mullie):
Fix patch-reference_wiki.sql index creation

We don't really need the IF EXISTS. I just added it to make it easier to uncorrupt your setup after having run the failing DB patch.
I've submitted a patch that just gets rid of the IF EXISTS. To uncorrupt your DB, guess you'll just have to recreate the first 2 indices so this DB patch doesn't fail over them not existing :)

Change 259477 merged by jenkins-bot:
Fix patch-reference_wiki.sql index creation

Catrope added a subscriber: Catrope.