Page MenuHomePhabricator

missing 'patch-add_interwiki.sql' for the includes/installer/PostgresqlUpdater.php
Open, Stalled, NormalPublic


Author: anton.kochkov

See the last functions in the file 'includes/installer/PostgresqlUpdater.php':

protected function addInterwikiType() {
$this->applyPatch( 'patch-add_interwiki.sql', false, "Refreshing add_interwiki()" );
protected function tsearchFixes() {

  1. Tweak the page_title tsearch2 trigger to filter out slashes
  2. This is create or replace, so harmless to call if not needed

$this->applyPatch( 'patch-ts2pagetitle.sql', false, "Refreshing ts2_page_title()" );

  1. If the server is 8.3 or higher, rewrite the tsearch2 triggers
  2. in case they have the old 'default' versions
  3. Gather version numbers in case we need them

if ( $this->db->getServerVersion() >= 8.3 ) {
$this->applyPatch( 'patch-tsearch2funcs.sql', false, "Rewriting tsearch2 triggers" );

All these *.sql files are missing. Moreover, addInterwikiType() calls even if interwiki table already exists.

Also patch-interwiki.sql for PostgreSQL should be:

CREATE TABLE /*$wgDBprefix*/interwiki (

  • The interwiki prefix, (e.g. "Meatball", or the language prefix "de")

iw_prefix varchar(32) NOT NULL,

  • The URL of the wiki, with "$1" as a placeholder for an article name.
  • Any spaces in the name will be transformed to underscores before
  • insertion.

iw_url byteea NOT NULL,

  • A boolean value indicating whether the wiki is in this project
  • (used, for example, to detect redirect loops)

iw_local BOOL NOT NULL,
PRIMARY KEY (iw_prefix),
UNIQUE (iw_prefix)
) /*$wgDBTableOptions*/;

But this is could be wrong too - upgrade script suggests that iw_local column translating into smallint type, so it should be already smallint from the start (bool->smallint translation is not allowed, afair).

So these SQL files and updater scripts should be syncronised for consistency.

Version: 1.24rc
Severity: normal
Whiteboard: aklapper-moreinfo



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 Normal.Nov 22 2014, 3:35 AM
bzimport added a project: Wikimedia-Rdbms.
bzimport set Reference to bz69360.
bzimport added a subscriber: Unknown Object (MLST).
bzimport created this task.Aug 10 2014, 9:35 AM

Thanks for taking the time to report this!

In case you (or anybody) feel like cooking up a patch, you are welcome to use Developer access

to submit this as a Git branch directly into Gerrit:

If you don't want to set up Git/Gerrit, you can also use

saper added a comment.Aug 26 2014, 2:30 PM

Is there any way you keep getting an error message?
A year ago I did extensive tests attempting to upgrade pretty various old PostgreSQL MediaWikis into something more recent.

How old is your MediaWiki? How old is your PostgreSQL installation?

Would that be possible for you to dump a schema of the database somewhere for me to test? (or even a whole DB if not private)?

Assuming you have a question related to the code:

This code relates to the "add_interwiki" SQL *function*, not table.
"interwiki" TABLE (with iw_local as CHAR NOT NULL) existed forever
in the history of the PostgreSQL port - the first checkin of the tables.sql
files contains the table already. Only later some fields where changed
(iw_local became SMALLINT as you mention) or were added, and this seems
to be reflected in the PostgresUpdater.

The code to add "add_interwiki" function lives in maintenance/postgres/archives/patch-add_interwiki.sql and seems to be fine to me.

Anton: Can you please answer comment 2?

Aklapper changed the task status from Open to Stalled.Nov 25 2014, 7:47 PM
scfc set Security to None.Nov 27 2014, 3:52 AM
scfc added a subscriber: scfc.
Jdforrester-WMF added a subscriber: Jdforrester-WMF.

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

Krinkle removed a subscriber: wikibugs-l-list.