Piwigo Bugtracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0001740Piwigophotospublic2010.06.23 00:222010.06.30 00:04
Reportermadman 
Assigned Tonikrou 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformPostgresqlOSCentOS 5.4OS VersionPostgresql 8.4.2
Product Version2.1.1 
Target VersionFixed in Version2.1.2 
Summary0001740: [PostgreSQL] Rating page returns database error
DescriptionThis is another query that has an incomplete GROUP BY. This in in admin/rating.php line 162.

Proposed query rewrite:

$query = '
SELECT i.id,
       i.path,
       i.file,
       i.tn_ext,
       i.average_rate,
       MAX(r.date) AS recently_rated,
       COUNT(r.rate) AS nb_rates,
       SUM(r.rate) AS sum_rates
  FROM '.RATE_TABLE.' AS r
    LEFT JOIN '.IMAGES_TABLE.' AS i ON r.element_id = i.id
  WHERE 1 = 1 ' . $page['user_filter'] . '
  GROUP BY i.id, i.path, i.file, i.tn_ext, i.average_rate
  ORDER BY ' . $available_order_by[$order_by_index][1] .'
  LIMIT '.$elements_per_page.' OFFSET '.$start.'
;';
Steps To ReproduceNew installation -> Administration -> Photos -> Rating
Additional InformationWarning: pg_query() [function.pg-query]: Query failed: ERROR: column "i.id" must appear in the GROUP BY clause or be used in an aggregate function LINE 2: SELECT i.id, ^ in /var/www/sites/fotos.aarjan.nl/piwigo/piwigo_svn/include/dblayer/functions_pgsql.inc.php on line 122
SELECT i.id, i.path, i.file, i.tn_ext, i.average_rate, MAX(r.date) AS recently_rated, COUNT(r.rate) AS nb_rates, SUM(r.rate) AS sum_rates FROM piwigo_rate AS r LEFT JOIN piwigo_images AS i ON r.element_id = i.id WHERE 1 = 1 GROUP BY r.element_id ORDER BY recently_rated DESC LIMIT 10 OFFSET 0 ;
ERROR: column "i.id" must appear in the GROUP BY clause or be used in an aggregate function LINE 2: SELECT i.id, ^
TagsNo tags attached.
browserMozilla
Database engine and versionPostgresql 8.4.2
PHP version5.3.2
Web serverApache 2.2.3
Attached Files

- Relationships

-  Notes
(0004008)
svn (reporter)
2010.06.25 23:19

[Subversion] r6606 by nikrou on branch 2.1

-----[Subversion commit log]----------------------------------------------------
Bug 1740 fixed : Rating page returns database error
Query had incomplete group by clause
(0004009)
svn (reporter)
2010.06.25 23:21

[Subversion] r6607 by nikrou on trunk

-----[Subversion commit log]----------------------------------------------------
Bug 1740 fixed : Bug 1740 fixed : Rating page returns database error
Query had incomplete group by clause
Merge from branch 2.1

- Issue History
Date Modified Username Field Change
2010.06.23 00:22 madman New Issue
2010.06.23 00:22 madman browser => Mozilla
2010.06.23 00:22 madman Database engine and version => Postgresql 8.4.2
2010.06.23 00:22 madman PHP version => 5.3.2
2010.06.23 00:22 madman Web server => Apache 2.2.3
2010.06.23 20:18 nikrou Status new => assigned
2010.06.23 20:18 nikrou Assigned To => nikrou
2010.06.25 23:19 svn Checkin
2010.06.25 23:19 svn Note Added: 0004008
2010.06.25 23:21 svn Checkin
2010.06.25 23:21 svn Note Added: 0004009
2010.06.25 23:21 nikrou Status assigned => closed
2010.06.25 23:21 nikrou Resolution open => fixed
2010.06.25 23:21 nikrou Fixed in Version => 2.1.2
2010.06.30 00:04 plg Summary Rating page returns database error => [PostgreSQL] Rating page returns database error


Copyright © 2000 - 2015 MantisBT Team
Contact
Powered by Mantis Bugtracker