Bug #51009 [Opn->Fbk]: PDO with pgsql returning NULL when integer expected in prepared query
| From: | felipe@php.net | Date: | Tue, 15 Nov 2011 12:05:44 +0000 |
| Subject: | Bug #51009 [Opn->Fbk]: PDO with pgsql returning NULL when integer expected in prepared query | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-165157@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=51009&edit=1
ID: 51009
Updated by: felipe@php.net
Reported by: peter at allicient dot co dot uk
Summary: PDO with pgsql returning NULL when integer expected
in prepared query
-Status: Open
+Status: Feedback
Type: Bug
Package: PDO related
Operating System: FreeBSD 8.0
PHP Version: 5.2.12
Block user comment: N
Private report: N
New Comment:
Please try using this snapshot:
http://snaps.php.net/php5.3-latest.tar.gz
For Windows:
http://windows.php.net/snapshots/
Previous Comments:
------------------------------------------------------------------------
[2010-02-11 03:27:00] peter at allicient dot co dot uk
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 this bug report at https://bugs.php.net/bug.php?id=51009&edit=1