Edit report at https://bugs.php.net/bug.php?id=58772&edit=1
ID: 58772
Updated by: php-bugs@lists.php.net
Reported by: michael dot leuthold at googlemail dot com
Summary: PDO::fetchAll() issue with INSERT on view
-Status: Feedback
+Status: No Feedback
Type: Bug
Package: *General Issues
Operating System: Linux / Debian
PHP Version: 5.2.6
Private report: N
New Comment:
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 "Re-Opened". Thank you.
Previous Comments:
------------------------------------------------------------------------
[2013-10-01 10:27:39] mike@php.net
Your reproduce scripts are not available anymore and PQresultStatus for an INSERT that that resolves
to a RULE with an SELECT as last statement returns PGRES_COMMAND_OK, so the result is freed
regardless.
------------------------------------------------------------------------
[2009-07-23 11:19:19] michael dot leuthold at googlemail dot com
Description:
------------
"ON INSERT" rule on view returns rows which cannot be retrieved by PDO::fetchAll():
We have a view that has a ON INSERT DO INSTEAD rule. In this rule the insert on the view is
basically split to do the actual inserts into the individual tables. In the end it SELECTs the new
row (which has just been created) from that view. Doing this in psql for example behaves like
expected: after the INSERT the new row is returned.
We haven't managed to retrieve that row into an array via
"PDO::fetchAll(PDO::FETCH_ASSOC)" - for some reason PDO seems to ignore that returned data
- though PDO::rowCount returns 1 (actually it does always return 1 no matter how many rows are
expected to be returned by that INSERT).
This scenario works as expected when connected via PHP's pg_connect using pg_fetch_all.
Information from phpinfo():
pdo_pgsql
PDO Driver for PostgreSQL enabled
PostgreSQL(libpq) Version 8.3.7
Module version 1.0.2
Revision $Id: pdo_pgsql.c,v 1.7.2.11.2.2 2007/12/31 07:20:10 sebastian Exp $
Reproduce code:
---------------
For a small schema setup run this file through psql:
http://www.byoc.de/pdo-pgsql.sql.txt
This script inserts to the created example view and tries to retrieve the values:
http://www.byoc.de/pdo-pgsql.php.txt
Expected result:
----------------
the associative array should contain all rows returned by the INSERT statement.
Actual result:
--------------
an empty array is returned by PDO::fetchAll though there are rows returned.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=58772&edit=1