From:             tichy at livada dot cz
Operating system: Linux
PHP version:      5CVS-2006-08-11 (snap)
PHP Bug Type:     PDO related
Bug description:  Error with aggregate MySQL functions

Description:
------------
Getting PDO exception (SQLSTATE[HY000]: General error: 2036) when using
aggregate function on PHP5 via PDO and MySQL5. (No problem when using
MySQL4 or without PDO).

PHP 5.2.0RC2-dev
MySQL 5.0.19





Reproduce code:
---------------
// MySQL

CREATE TABLE `test` (
  `ids` int(11) NOT NULL,
  `value` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

-- 
-- Dumping data for table `test`
-- 

INSERT INTO `test` VALUES (10, 23);
INSERT INTO `test` VALUES (10, 13);

// PHP


$query = 'SELECT AVG(value) FROM test WHERE ids=10 GROUP BY ids';

$dbh = new PDO($dsn, $user, $password);
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$rs = $dbh->query($query);
$result = $rs->fetchAll(PDO::FETCH_ASSOC);
print_r($result);

Expected result:
----------------
Array
(
    [0] => Array
        (
            [AVG(value)] => 18.0000
        )

)


Actual result:
--------------
Fatal error:  Uncaught exception 'PDOException' with message
'SQLSTATE[HY000]: General error: 2036

-- 
Edit bug report at http://bugs.php.net/?id=38433&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=38433&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=38433&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=38433&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=38433&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=38433&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=38433&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=38433&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=38433&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=38433&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=38433&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=38433&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=38433&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=38433&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=38433&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=38433&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=38433&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=38433&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=38433&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=38433&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=38433&r=mysqlcfg

Reply via email to