https://bugzilla.wikimedia.org/show_bug.cgi?id=27348

           Summary: Running upgrade.php shows postgres error when databse
                    user contains a '-'
           Product: MediaWiki
           Version: 1.16.2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: Normal
         Component: Maintenance scripts
        AssignedTo: wikibugs-l@lists.wikimedia.org
        ReportedBy: t...@whyscream.net
                CC: innocentkil...@gmail.com


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'" );

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to