#18713 [Opn->Bgs]: pg_exec does not return objectid from insert

From: Date: Fri, 02 Aug 2002 23:03:20 +0000
Subject: #18713 [Opn->Bgs]: pg_exec does not return objectid from insert
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-15874@lists.php.net to get a copy of this message
ID: 18713 Updated by: sniper@php.net Reported By: jam@newimage.com -Status: Open +Status: Bogus Bug Type: PostgreSQL related Operating System: redhat 7.3 PHP Version: 4.1.2 New Comment: Thank you for taking the time to report a problem with PHP. Unfortunately you are not using a current version of PHP -- the problem might already be fixed. Please download a new PHP version from http://www.php.net/downloads.php If you are able to reproduce the bug with one of the latest versions of PHP, please change the PHP version on this bug report to the version you tested and change the status back to "Open". Again, thank you for your continued support of PHP. Previous Comments: ------------------------------------------------------------------------ [2002-08-02 17:01:08] jam@newimage.com I've found what I believe is a bug in the php postgresql module. Consider this code: 1 $db = pg_connect("dbname=phpserve user=apache"); 2 3 $sql = "insert into orders(userid, datestamp, completed) 4 values ('0', 'now()', 'f')"; 5 $res = pg_exec($sql) or die("invalid query"); 6 7 print_r($res); 8 print "<br />"; 9 print count($res); 10 $foo = pg_fetch_row($res, 0); 11 print_r($foo); the insert runs fine. the output is "Resource id #2" (which is good), then a 1 (for the count, which is also good) and then an error for the pg_fetch_row() call (error is "PHP Warning: Unable to jump to row 0 on PostgreSQL result index 2 in /var/www/html/phpserve/test.php on line 11") which is where the problem lies. the result from an insert should be the objectid of the record. I'm willing to entertain the possibility that I've done something wrong with my code, and that this isn't a bug in php. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=18713&edit=1

« previous php.bugs (#15874) next »