ID: 24679 Updated by: [EMAIL PROTECTED] Reported By: rorezende at hotmail dot com -Status: No Feedback +Status: Closed Bug Type: PostgreSQL related Operating System: * PHP Version: 4.3.2 Assigned To: helly New Comment:
This bug has been fixed in CVS. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2007-08-23 14:41:23] frank at geo-dienstleistung dot de This seems to be true for more than only pg_insert() function. The same error rises when pg_convert() is called with schema in front of table name. So I suspect without testing, that pg_update() and pg_delete suffer from the same bug. ------------------------------------------------------------------------ [2007-08-23 10:42:10] frank at geo-dienstleistung dot de I can confirm this bug on php 5.2.1 too. It really makes this function pretty much useless. ------------------------------------------------------------------------ [2007-03-14 16:07:04] pentropia at gmail dot com Iv'e noticed the same problem on php 5.2.1 ------------------------------------------------------------------------ [2005-09-21 05:04:00] nathanr at nathanr dot net Nope, this is a genuine bug, I've tested on SuSE Linux Professional 9.3 using both PHP 4.3.10 and 5.0.3 against PostgreSQL 8.0.3. They both produce non-working results. To replicate the bug: test.sql: create schema tstschma; create table tstschma.tsttbl ( x int not null, y int not null, primary key (x) ); now try this php: $db = pg_connect("dbname=testdb"); $l = array('x'=>'1', 'y'=>'2'); pg_insert($db, "tstschma.tsttbl", $l); pg_close($db); If you remove the schema (tstschma) from the name then the select works, but the insert of course does not. The problem stems from the fact that pg_class.relname does not include the schema name, but to run a query against the table you must have the schema name. I suggest your fix is to strip everything before and including the last dot in the table name (won't change anything for those not using schemas, but will strip "tstschma." from the above example), but use the table name passed to the method (ie. including the "tstschma.") when you go to do the insert. ------------------------------------------------------------------------ [2005-09-21 05:03:41] nathanr at nathanr dot net Nope, this is a genuine bug, I've tested on SuSE Linux Professional 9.3 using both PHP 4.3.10 and 5.0.3 against PostgreSQL 8.0.3. They both produce non-working results. To replicate the bug: test.sql: create schema tstschma; create table tstschma.tsttbl ( x int not null, y int not null, primary key (x) ); now try this php: $db = pg_connect("dbname=testdb"); $l = array('x'=>'1', 'y'=>'2'); pg_insert($db, "tstschma.tsttbl", $l); pg_close($db); If you remove the schema (tstschma) from the name then the select works, but the insert of course does not. The problem stems from the fact that pg_class.relname does not include the schema name, but to run a query against the table you must have the schema name. I suggest your fix is to strip everything before and including the last dot in the table name (won't change anything for those not using schemas, but will strip "tstschma." from the above example), but use the table name passed to the method (ie. including the "tstschma.") when you go to do the insert. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/24679 -- Edit this bug report at http://bugs.php.net/?id=24679&edit=1