Quote $default in PostgresUpdater::setDefault
authorReedy <reedy@wikimedia.org>
Sat, 9 Sep 2017 16:11:24 +0000 (17:11 +0100)
committerReedy <reedy@wikimedia.org>
Sat, 9 Sep 2017 16:18:46 +0000 (16:18 +0000)
Bug: T175439
Change-Id: Id5f5f4f34c7b9ff9af4b706e3e126ba8fda6a0d5

includes/installer/PostgresUpdater.php

index e5a5c94..07aeb13 100644 (file)
@@ -783,7 +783,8 @@ END;
                $info = $this->db->fieldInfo( $table, $field );
                if ( $info->defaultValue() !== $default ) {
                        $this->output( "Changing '$table.$field' default value\n" );
                $info = $this->db->fieldInfo( $table, $field );
                if ( $info->defaultValue() !== $default ) {
                        $this->output( "Changing '$table.$field' default value\n" );
-                       $this->db->query( "ALTER TABLE $table ALTER $field SET DEFAULT " . $default );
+                       $this->db->query( "ALTER TABLE $table ALTER $field SET DEFAULT "
+                               . $this->db->addQuotes( $default ) );
                }
        }
 
                }
        }