Possible bug in mysql adapter?

33 views
Skip to first unread message

Ashwin Jacob

unread,
Apr 30, 2014, 11:38:18 AM4/30/14
to open...@googlegroups.com
Branch used: 4.0.2-rc1

Problem:

On completing a fresh install of openphoto using the version mentioned above, the browser is directed to /photos/upload?m=welcome and receives an error page (HTTP 500). This is what the error log said

[Wed Apr 30 09:44:48.200364 2014] [:error] [pid 1443] [client 192.168.1.22:49834] {severity:warn, description:"Uncaught exception (/home/zz/openphotofrontend/src/libraries/external/epi/EpiException.php:13): Query error: SQLSTATE[42000]: Syntax error or access violation: 1140 Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause - SELECT COUNT(*) FROM `album` WHERE `owner`=:owner ORDER BY `name`", additional:}, referer: http://photos/setup/3

[Wed Apr 30 09:44:55.274949 2014] [:error] [pid 1433] [client 192.168.1.22:49837] {severity:warn, description:"Uncaught exception (/home/zz/openphotofrontend/src/libraries/external/epi/EpiException.php:13): Query error: SQLSTATE[42000]: Syntax error or access violation: 1140 Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause - SELECT COUNT(*) FROM `album` WHERE `owner`=:owner ORDER BY `name`", additional:}, referer: http://photos/photos/upload?m=welcome

[Wed Apr 30 09:44:55.337941 2014] [:error] [pid 1435] [client 192.168.1.22:49838] {severity:warn, description:"Uncaught exception (/home/zz/openphotofrontend/src/libraries/external/epi/EpiException.php:13): Query error: SQLSTATE[42000]: Syntax error or access violation: 1140 Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause - SELECT COUNT(*) FROM `album` WHERE `owner`=:owner ORDER BY `name`", additional:}, referer: http://photos/photos/upload?m=welcome

On investigating the error (a SQL query possibly missing a GROUP BY statement)
  • looking at what happened in the upload method of the PhotoController lead me to look at $this->api->invoke('/albums/list.json' which could potentially do a database query. Tracing that to
  • list method of ApiAlbumController
  • getAlbums method on an Adapter (i suspect being the mysql one)
  • to the following code
      $albumsCount = $this->db->one("SELECT COUNT(*) FROM `{$this->mySqlTablePrefix}album` WHERE `owner`=:owner ORDER BY `name`", array(':owner' => $this->owner));


  • This will evaluate to something like SELECT COUNT(*) FROM `album` WHERE `owner`=xyz ORDER BY 'name`.
  • That will result in a mysql 1140 error.
Was the intention to get the album count for the 'owner'? If so is the order by name relevant in the query?

Thanks,

Ashwin

Jaisen Mathai

unread,
Apr 30, 2014, 1:42:25 PM4/30/14
to open...@googlegroups.com
Ashwin, Thanks for the detailed email. I've opened an issue on Github. Let's discuss there. https://github.com/photo/frontend/issues/1473 -- Jaisen


--
You received this message because you are subscribed to the Google Groups "OpenPhoto" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openphoto+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages