Running svn head on postgresql when I try to edit categories, I get the
following error:
Database error
Invalid SQL: SELECT
1,cat_name,cat_description,cat_data,cat_parent,cat_owner,cat_appname,count(news_content)
AS num_news,MAX(news_date) AS news_date,egw_categories.cat_id AS cat_id
FROM egw_news RIGHT JOIN egw_categories ON
egw_news.cat_id=egw_categories.cat_id WHERE cat_appname=‘news_admin’ GROUP
BY egw_categories.cat_id ORDER BY news_date DESC:
ERROR: column “egw_categories.cat_name” must appear in the GROUP BY clause
or be used in an aggregate function
#0 /usr/local/egroupware/phpgwapi/inc/class.egw_db.inc.php(538):
egw_db->halt(‘Invalid SQL: SE…’, 766, ‘/usr/local/egro…’) #1 /usr/local/egroupware/phpgwapi/inc/class.egw_db.inc.php(1709):
egw_db->query(‘SELECT 1,cat_na…’, 766, ‘/usr/local/egro…’, false, -1) #2 /usr/local/egroupware/etemplate/inc/class.so_sql.inc.php(766):
egw_db->select(‘egw_news’, ‘1,cat_name,cat_…’, Array,
766, ‘/usr/local/egro…’, false, ‘GROUP BY egw_ca…’, false, 0, ‘RIGHT
JOIN egw_…’) #3 /usr/local/egroupware/news_admin/inc/class.bonews.inc.php(284):
so_sql->search(Array, ‘1’, ‘GROUP BY egw_ca…’, Array, ‘%’, false, ‘OR’,
Array, Array, ‘RIGHT JOIN egw_…’) #4 /usr/local/egroupware/news_admin/inc/class.bonews.inc.php(390):
bonews->search(Array, ‘1’, ‘GROUP BY egw_ca…’, Array, ‘%’, false, ‘OR’,
Array, Array, ‘RIGHT JOIN egw_…’) #5 /usr/local/egroupware/news_admin/inc/class.news_admin_ui.inc.php(210):
bonews->get_cats(Array, NULL) #6 /usr/local/egroupware/etemplate/inc/class.nextmatch_widget.inc.php(278):
news_admin_ui->get_cats(Array, NULL, NULL) #7 /usr/local/egroupware/etemplate/inc/class.boetemplate.inc.php(538):
nextmatch_widget->pre_process(‘exec[nm]’, Array, Array, Array, Array,
Object(etemplate)) #8 /usr/local/egroupware/etemplate/inc/class.uietemplate.inc.php(1022):
boetemplate->extensionPreProcess(‘nextmatch’, ‘exec[nm]’, Array, Array,
Array) #9 /usr/local/egroupware/etemplate/inc/class.uietemplate.inc.php(825):
etemplate->show_cell(Array, Array, Array, ‘exec’, 0, 1, ‘’, ‘’, ‘/0/2A’) #10 /usr/local/egroupware/etemplate/inc/class.uietemplate.inc.php(1351):
etemplate->show_grid(Array, Array, Array, ‘exec’, 0, 0, ‘/0’) #11 /usr/local/egroupware/etemplate/inc/class.uietemplate.inc.php(628):
etemplate->show_cell(Array, Array, Array, ‘exec’, 0, 0, ‘’, NULL, ‘/0’) #12 /usr/local/egroupware/etemplate/inc/class.uietemplate.inc.php(233):
etemplate->show(Array, Array, Array, ‘exec’) #13 /usr/local/egroupware/news_admin/inc/class.news_admin_ui.inc.php(194):
etemplate->exec(‘news_admin.news…’, Array, Array, NULL) #14 /usr/local/egroupware/phpgwapi/inc/common_functions.inc.php(796):
news_admin_ui->cats() #15 /usr/local/egroupware/index.php(133): ExecMethod(‘news_admin.news…’) #16 {main}Database error
Invalid SQL: SELECT
1,cat_name,cat_description,cat_data,cat_parent,cat_owner,cat_appname,count(news_content)
AS num_news,MAX(news_date) AS news_date,egw_categories.cat_id AS cat_id
FROM egw_news RIGHT JOIN egw_categories ON
egw_news.cat_id=egw_categories.cat_id WHERE cat_appname=‘news_admin’ GROUP
BY egw_categories.cat_id ORDER BY news_date DESC:
ERROR: column “egw_categories.cat_name” must appear in the GROUP BY clause
or be used in an aggregate function
#0 /usr/local/egroupware/phpgwapi/inc/class.egw_db.inc.php(538):
egw_db->halt(‘Invalid SQL: SE…’, 766, ‘/usr/local/egro…’) #1 /usr/local/egroupware/phpgwapi/inc/class.egw_db.inc.php(1709):
egw_db->query(‘SELECT 1,cat_na…’, 766, ‘/usr/local/egro…’, false, -1) #2 /usr/local/egroupware/etemplate/inc/class.so_sql.inc.php(766):
egw_db->select(‘egw_news’, ‘1,cat_name,cat_…’, Array,
766, ‘/usr/local/egro…’, false, ‘GROUP BY egw_ca…’, false, 0, ‘RIGHT
JOIN egw_…’) #3 /usr/local/egroupware/news_admin/inc/class.bonews.inc.php(284):
so_sql->search(Array, ‘1’, ‘GROUP BY egw_ca…’, Array, ‘%’, false, ‘OR’,
Array, Array, ‘RIGHT JOIN egw_…’) #4 /usr/local/egroupware/news_admin/inc/class.bonews.inc.php(390):
bonews->search(Array, ‘1’, ‘GROUP BY egw_ca…’, Array, ‘%’, false, ‘OR’,
Array, Array, ‘RIGHT JOIN egw_…’) #5 /usr/local/egroupware/news_admin/inc/class.news_admin_ui.inc.php(210):
bonews->get_cats(Array, NULL) #6 /usr/local/egroupware/etemplate/inc/class.nextmatch_widget.inc.php(278):
news_admin_ui->get_cats(Array, NULL, NULL) #7 /usr/local/egroupware/etemplate/inc/class.boetemplate.inc.php(538):
nextmatch_widget->pre_process(‘exec[nm]’, Array, Array, Array, Array,
Object(etemplate)) #8 /usr/local/egroupware/etemplate/inc/class.uietemplate.inc.php(1022):
boetemplate->extensionPreProcess(‘nextmatch’, ‘exec[nm]’, Array, Array,
Array) #9 /usr/local/egroupware/etemplate/inc/class.uietemplate.inc.php(825):
etemplate->show_cell(Array, Array, Array, ‘exec’, 0, 1, ‘’, ‘’, ‘/0/2A’) #10 /usr/local/egroupware/etemplate/inc/class.uietemplate.inc.php(1351):
etemplate->show_grid(Array, Array, Array, ‘exec’, 0, 0, ‘/0’) #11 /usr/local/egroupware/etemplate/inc/class.uietemplate.inc.php(628):
etemplate->show_cell(Array, Array, Array, ‘exec’, 0, 0, ‘’, NULL, ‘/0’) #12 /usr/local/egroupware/etemplate/inc/class.uietemplate.inc.php(233):
etemplate->show(Array, Array, Array, ‘exec’) #13 /usr/local/egroupware/news_admin/inc/class.news_admin_ui.inc.php(194):
etemplate->exec(‘news_admin.news…’, Array, Array, NULL) #14 /usr/local/egroupware/phpgwapi/inc/common_functions.inc.php(796):
news_admin_ui->cats() #15 /usr/local/egroupware/index.php(133): ExecMethod(‘news_admin.news…’) #16 {main}
I’ve attached a fix for PostgreSQL but I have no idea if that works on Mysql
too.
–
Lars