#51009 [NEW]: PDO with pgsql returning NULL when integer expected in prepared query
| From: | peter at allicient dot co dot uk | Date: | Thu, 11 Feb 2010 03:27:00 +0000 |
| Subject: | #51009 [NEW]: PDO with pgsql returning NULL when integer expected in prepared query | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-147424@lists.php.net to get a copy of this message | ||
From: peter at allicient dot co dot uk
Operating system: FreeBSD 8.0
PHP version: 5.2.12
PHP Bug Type: PDO related
Bug description: PDO with pgsql returning NULL when integer expected in prepared query
Description:
------------
When using a prepared SELECT query of the form "SELECT table_a.column_id,
table_a.column_some_string FROM table_a LEFT OUTER JOIN table_b ON
(table_a.column_id = table_b.foreign_key_id)" - which executes successfully
- there is a problem fetching the results.
Using fetchAll( PDO::FETCH_ASSOC ) returns the rows with the strings
intact but the column_id (integer) as NULL. PDO::FETCH_BOTH shows that
numerically indexed rows have the column_id as expected but the error still
present when indexed by the column name.
The same query performed via pgadmin3 returns the expected results, and is
the same as PDO::FETCH_NUM so there is definitely a problem with
PDO::FETCH_ASSOC.
Other SELECT queries work as expected, it seems to be related to the "LEFT
OUTER JOIN".
It can be coded around but is nonetheless a curious error.
Expected result:
----------------
For the PDO::FETCH_ASSOC to return the same data as PDO::FETCH_NUM.
--
Edit bug report at http://bugs.php.net/?id=51009&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=51009&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=51009&r=trysnapshot53
Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=51009&r=trysnapshot60
Fixed in SVN: http://bugs.php.net/fix.php?id=51009&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=51009&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=51009&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=51009&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=51009&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=51009&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=51009&r=support
Expected behavior: http://bugs.php.net/fix.php?id=51009&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=51009&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=51009&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=51009&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=51009&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=51009&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=51009&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=51009&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=51009&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=51009&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=51009&r=mysqlcfg