php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51009 PDO with pgsql returning NULL when integer expected in prepared query
Submitted: 2010-02-11 03:27 UTC Modified: 2013-02-18 00:34 UTC
From: peter at allicient dot co dot uk Assigned:
Status: No Feedback Package: PDO related
PHP Version: 5.2.12 OS: FreeBSD 8.0
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: peter at allicient dot co dot uk
New email:
PHP Version: OS:

 

 [2010-02-11 03:27 UTC] 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.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-11-15 12:05 UTC] felipe@php.net
-Status: Open +Status: Feedback
 [2011-11-15 12:05 UTC] felipe@php.net
Please try using this snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2013-02-18 00:34 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 02 03:01:29 2024 UTC