ID: 42632 Updated by: [EMAIL PROTECTED] Reported By: mattsch at gmail dot com -Status: Open +Status: Bogus Bug Type: PDO related Operating System: Gentoo Linux PHP Version: 5.2.4 New Comment:
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php This is expected behavior. The SQL standard mandates that identifiers are not case sensitive and that all unquoted identifiers be returned in upper case. However this is a question of the underlying client API. In the case of PostgreSQL the developers deliberately decided to return identifiers lower case by default. You can force a specific case (though not mixed case or case preserving) via a connection/statement level attribute. Check the documentation. Previous Comments: ------------------------------------------------------------------------ [2007-09-11 21:31:00] mattsch at gmail dot com Description: ------------ PDO fetch doesn't preserve the case of the column. I don't know if this is a "feature" or if it is a bug, but if it is a "feature" since the beginning of PDO, could I also suggest that another flag be added for PDO fetch to tell it to preserve the case? Reproduce code: --------------- <?php try { $pdo = new PDO("pgsql:host={$host};dbname={$database}", $user, $password); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $pdo->query("SET search_path to {$schema}"); $accountState = $pdo->prepare(' SELECT id AS accountId FROM account WHERE id = ? '); $accountState->bindParam(1, $id, PDO::PARAM_INT); $accountState->execute(); $getAccount = $accountState->fetch(PDO::FETCH_OBJ); $accountState->closeCursor(); var_dump($getAccount); } catch (Exception $e){ print "An error occurred: {$e->getMessage()}"; } ?> Expected result: ---------------- object(stdClass)#8 (1) { ["accountId"]=> int(339) } Actual result: -------------- object(stdClass)#8 (1) { ["accountid"]=> int(339) } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=42632&edit=1