Page MenuHomePhabricator

Running upgrade.php shows postgres error when databse user contains a '-'
Closed, ResolvedPublic

Description

Author: tom

Description:
Running update.php in mediawiki 1.16.2 (also seen in 1.16.1) with a postgres backend shows the following output:

... search_path for user "blah-www" looks correct (mediawiki, public)
Setting client_min_messages to 'error' for user "blah-www"
PHP Warning: pg_query(): Query failed: ERROR: syntax error at or near "-"
LINE 1: ALTER USER blah-www SET client_min_messages = 'error'

After some scouring around in the source, I believe the problem is that around line 1549 in updaters.inc, $wgDbuser is passed unquoted to postgres:

$wgDatabase->doQuery( "ALTER USER $wgDBuser SET $key = '$value'" );

This ofcourse fails when $wgDbuser contains a minus-sign. Correct syntax would use double quotes:

$wgDatabase->doQuery( "ALTER USER \"$wgDBuser\" SET $key = '$value'" );


Version: 1.16.x
Severity: normal

Details

Reference
bz27348

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, 11:13 PM
bzimport set Reference to bz27348.
bzimport added a subscriber: Unknown Object (MLST).
Jdforrester-WMF subscribed.

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