Comments

Posted by Simon Mundy (peptolab) on 2008-05-25T22:34:47.000+0000

I notice that you're using phpMyAdmin and the 'mysql' adapter - what adapter are you using for the framework? Pdo_Mysql or Mysqli? What happens if you try to use either of those adapters with that query?

The exception you're seeing indicates a driver-level exception rather than a Zend exception, so it would be good to narrow this down.

I cannot see how this issue was resolved with 'not an issue'. I just ran into this error too (1.7.x). If you google the error, you only get results referring to ZF, which makes it obvious that it has got to be somehow related to ZF. Will try to reproduce later.

Posted by Ralph Schindler (ralph) on 2009-05-19T12:37:37.000+0000

Can you please provide a small reproduction script of this? Something that will demonstrate behavior as well as with the db table it its querying against. As small as possible to trigger the error.

SELECT
hoardings_id, COUNT(camhashoa.hoardings_id) AS hoardings_count
FROM
campaigns_has_hoardings AS camhashoa
LEFT JOIN
hoardings AS hoa
USING(hoardings_id)

GROUP BY
hoardings_id

It is being caused by the group function COUNT(...) - no matter if I specify one column, or all of them (*). The query simply joins two tables in a 1:N relation and counts the occurences of that "N" rows ... this is really a basic mysql stuff(!)

I have this query stored in $query string. When I execute this query with

$this->fetchRow($select);

then the error occurs. When I use

$this->getAdapter()->fetchAll($select, array(), Zend_Db::FETCH_OBJ);

everything runs fine. The query is also valid in every other usage environment, except zend framework. I tried to use the getAdapter->fetchAll hack, but then ran into trouble since I've been using the Zend_Paginator, which obviously doesn't except this bug here and fails.