Last modified: 2012-08-04 20:48:42 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 27348 - Running upgrade.php shows postgres error when databse user contains a '-'
Running upgrade.php shows postgres error when databse user contains a '-'
Product: MediaWiki
Classification: Unclassified
Maintenance scripts (Other open bugs)
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
Depends on:
Blocks: postgres
  Show dependency treegraph
Reported: 2011-02-11 23:30 UTC by tom
Modified: 2012-08-04 20:48 UTC (History)
3 users (show)

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


Description tom 2011-02-11 23:30:20 UTC
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, $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'" );
Comment 1 Greg Sabino Mullane 2011-03-23 12:15:07 UTC
Fix applied in r84593
Comment 2 p858snake 2011-03-23 12:16:24 UTC
FIXED per comment 1

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