Query Problems with PDO, PDO_PGSQL

From: Date: Thu, 24 Feb 2005 21:42:02 +0000
Subject: Query Problems with PDO, PDO_PGSQL
Groups: php.pecl.dev 
Request: Send a blank email to pecl-dev+get-2055@lists.php.net to get a copy of this message
I believe there's a bug with using database side functions in a SELECT with PDO_PGSQL. When I issue the following query in psql I get the results as such: framewerk_www=> SELECT a.category, count(b.cmskey) AS cnt FROM cms_categories AS a LEFT JOIN cms_keys AS b ON b.category = a.category GROUP BY a.category ORDER BY a.category; category | cnt -------------------+----- Documentation | 7 Public | 13 Site Instructions | 5 (3 rows) However the following code produces the results with nothing in the "cnt" column: $query = $this->PDO->prepare("SELECT a.category, count(b.cmskey) AS cnt FROM cms_categories AS a LEFT JOIN cms_keys AS b ON b.category = a.category GROUP BY a.category ORDER BY a.category;"); $query->Execute(); $rows = $query->fetchAll(PDO_FETCH_OBJ); print_r($rows); Array ( [0] => stdClass Object ( [category] => Documentation [cnt] => ) [1] => stdClass Object ( [category] => Public [cnt] => ) [2] => stdClass Object ( [category] => Site Instructions [cnt] => ) ) Likewise if I change fetchAll to include no parameters: Array ( [0] => Array ( [category] => Documentation [0] => Documentation [cnt] => [1] => ) [1] => Array ( [category] => Public [0] => Public [cnt] => [1] => ) [2] => Array ( [category] => Site Instructions [0] => Site Instructions [cnt] => [1] => ) ) Also please be aware I believe there is still a pear installation issue with PDO having to do with case sensitivity. when you do a pear install pdo_pgsql-beta it looks to see if "pdo" is installed. But pear only sees "PDO" installed, and says it's not. Gavin

« previous php.pecl.dev (#2055) next »