]> git.mjollnir.org Git - s9y.git/commitdiff
(Hopefully) fix postgreSQL error
authorgarvinhicking <garvinhicking>
Mon, 19 Sep 2005 15:21:21 +0000 (15:21 +0000)
committergarvinhicking <garvinhicking>
Mon, 19 Sep 2005 15:21:21 +0000 (15:21 +0000)
include/functions_entries.inc.php

index 52b4c64114fd3e17959c0d8014c092ee6f4d1fe9..d55124af52f27a6532d3821e3ecc422df1a13ec5 100644 (file)
@@ -430,8 +430,23 @@ function serendipity_fetchCategories($authorid = null, $name = null, $order = nu
         $where .= " c.category_name = '" . serendipity_db_escape_string($name) . "'";
     }
 
-    $querystring = "SELECT
-                           c.*,
+    if ($serendipity['dbType'] == 'postgres') {
+        $group    = '';
+        $distinct = 'DISTINCT';
+    } else {
+        $group    = 'GROUP BY c.categoryid';
+        $distinct = '';
+    }
+
+    $querystring = "SELECT $distinct c.categoryid,
+                           c.category_name,
+                           c.category_icon,
+                           c.category_description,
+                           c.authorid,
+                           c.category_left,
+                           c.category_right,
+                           c.parentid,
+
                            a.username,
                            a.realname
                       FROM {$serendipity['dbPrefix']}category AS c
@@ -442,7 +457,7 @@ function serendipity_fetchCategories($authorid = null, $name = null, $order = nu
            LEFT OUTER JOIN {$serendipity['dbPrefix']}access AS acl 
                         ON (ag.groupid = acl.groupid AND acl.artifact_id = c.categoryid)
                            $where
-                  GROUP BY c.categoryid";
+                           $group";
 
     if (!empty($order)) {
         $querystring .= "\n ORDER BY $order";