From 7c6a7872951e8fa353efcbe541416d0094af800f Mon Sep 17 00:00:00 2001
From: Steven Wittens <steven@10.no-reply.drupal.org>
Date: Sat, 5 Feb 2005 00:12:24 +0000
Subject: [PATCH] - #16111: bad quotes in db_rewrite_sql

---
 includes/database.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/includes/database.inc b/includes/database.inc
index e6ad4baba80d..3931fda1ed29 100644
--- a/includes/database.inc
+++ b/includes/database.inc
@@ -231,7 +231,7 @@ function db_rewrite_sql($query, $primary_table = 'n', $primary_field = 'nid',  $
   list($join, $where, $distinct) = _db_rewrite_sql($query, $primary_table, $primary_field, $args);
 
   if ($distinct) {
-    $field_to_select = 'DISTINCT($primary_table .'.'. $primary_field)';
+    $field_to_select = 'DISTINCT('. $primary_table .'.'. $primary_field .')';
     // (?<!text) is a negative look-behind (no need to rewrite queries that already use DISTINCT).
     $query = preg_replace('/(SELECT.*)('. $primary_table .'\.)?(?<!DISTINCT\()(?<!DISTINCT\('. $primary_table .'\.)'. $primary_field .'(.*FROM)/AUsi', '\1'. $field_to_select .'\3', $query);
   }
-- 
GitLab