[fixed] Next Postgres-query failed (plugin_internal.inc.php)
Posted: Wed Oct 26, 2005 7:57 am
Playing around with another testblog (S9Y 0.9beta3), I found another Postgres-related "error" within plugin_internal.inc.php. When the categories-sidebar-plugin was activated, PHP throws out an error within a "GROUP BY"-statement
Here's the fix that works for me. Please check:Warning: pg_query(): Query failed: ERROR: column "c.categoryid" must appear in the GROUP BY clause or be used in an aggregate function in /var/www/cmstest/include/db/postgres.inc.php on line 113
Error in SELECT c.categoryid, c.category_name, count(e.id) as postings FROM roothell_entrycat ec, roothell_category c, roothell_entries e WHERE ec.categoryid = c.categoryid AND ec.entryid = e.id GROUP BY ec.categoryid, c.category_name ORDER BY postings DESC
ERROR: column "c.categoryid" must appear in the GROUP BY clause or be used in an aggregate function
Code: Select all
--- include/plugin_internal.inc.php.old 2005-10-26 07:50:53.000000000 +0200
+++ include/plugin_internal.inc.php 2005-10-26 07:51:01.000000000 +0200
@@ -1281,7 +1281,7 @@
{$serendipity['dbPrefix']}category c,
{$serendipity['dbPrefix']}entries e
WHERE ec.categoryid = c.categoryid AND ec.entryid = e.id
- GROUP BY ec.categoryid, c.category_name
+ GROUP BY c.categoryid, c.category_name
ORDER BY postings DESC";
$category_rows = serendipity_db_query($cat_sql);
if (is_array($category_rows)) {