From eaa91d7abf293d021cebe219c8140ac20686e8fb Mon Sep 17 00:00:00 2001 From: Ryan Schmidt Date: Mon, 2 May 2016 13:04:47 -0500 Subject: [PATCH] Quote column name aliases Sometimes, a column name alias is chosen that is a reserved word or is otherwise invalid (such as an alias named "user" on postgres or mssql). Let's unconditionally quote the alias so that no matter what the user specifies, it will not cause the query to error out. Bug: T118973 Change-Id: If3ea7324980355e78afcdb3bf2596d23bb96412d --- includes/db/Database.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/db/Database.php b/includes/db/Database.php index c36cfdb453..8807e13439 100644 --- a/includes/db/Database.php +++ b/includes/db/Database.php @@ -1847,7 +1847,7 @@ abstract class DatabaseBase implements IDatabase { if ( !$alias || (string)$alias === (string)$name ) { return $name; } else { - return $name . ' AS ' . $alias; // PostgreSQL needs AS + return $name . ' AS ' . $this->addIdentifierQuotes( $alias ); // PostgreSQL needs AS } } -- 2.20.1