#37124 [NEW]: PostgreSQL Query Returns Resource id for Field Value

From: Date: Tue, 18 Apr 2006 17:54:08 +0000
Subject: #37124 [NEW]: PostgreSQL Query Returns Resource id for Field Value
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-95941@lists.php.net to get a copy of this message
From: ahaig at penguinmilitia dot net Operating system: Mac OS X 10.4.6 PHP version: 5.1.2 PHP Bug Type: PDO related Bug description: PostgreSQL Query Returns Resource id for Field Value Description: ------------ I'm using PostgreSQL 8.0.2 Query: SELECT t.tgargs as args FROM pg_trigger t,pg_class c,pg_proc p WHERE t.tgenabled AND t.tgrelid = c.oid AND t.tgfoid = p.oid AND p.proname = 'RI_FKey_check_ins' AND c.relname =:tablename ORDER BY t.tgrelid :tablename is bound to a var with the value 'tables' (for my particular case), and the same result occurs if I do not use binding and fill the string in myself with 'tables' instead of :tablename. When I run the query in psql it returns: args ------------------------------------------------------------ tables_mainclassname_fkey\000tables\000classes \000UNSPECIFIED\000mainclassname\000object_class\000 tables_databasehandle_fkey\000tables\000databases \000UNSPECIFIED\000databasehandle\000databasehandle\000 (2 rows) Reproduce code: --------------- $statement = $my_PDO_instance->prepare("SELECT t.tgargs as args FROM pg_trigger t,pg_class c,pg_proc p WHERE t.tgenabled AND t.tgrelid = c.oid AND t.tgfoid = p.oid AND p.proname = 'RI_FKey_check_ins' AND c.relname =:tablename ORDER BY t.tgrelid"); $statement->bindParam( ':tablename', $table ); $statement->execute(); print_r($statement->fetchAll()); The same thing occurs if I do: foreach ( $my_PDO_instance->query("SELECT t.tgargs as args FROM pg_trigger t,pg_class c,pg_proc p WHERE t.tgenabled AND t.tgrelid = c.oid AND t.tgfoid = p.oid AND p.proname = 'RI_FKey_check_ins' AND c.relname =:tablename ORDER BY t.tgrelid") as $this_row ) { print_r($this_row); } Expected result: ---------------- Array ( [args] => tables_mainclassname_fkey\000tables \000classes\000UNSPECIFIED\000mainclassname\000object_class \000 ) Array ( [args] => tables_databasehandle_fkey\000tables \000databases\000UNSPECIFIED\000databasehandle \000databasehandle\000 ) Actual result: -------------- Array ( [args] => Resource id #20 ) Array ( [args] => Resource id #21 ) -- Edit bug report at http://bugs.php.net/?id=37124&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=37124&r=trysnapshot44 Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=37124&r=trysnapshot51 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=37124&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=37124&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=37124&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=37124&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=37124&r=needscript Try newer version: http://bugs.php.net/fix.php?id=37124&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=37124&r=support Expected behavior: http://bugs.php.net/fix.php?id=37124&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=37124&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=37124&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=37124&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=37124&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=37124&r=dst IIS Stability: http://bugs.php.net/fix.php?id=37124&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=37124&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=37124&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=37124&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=37124&r=mysqlcfg

« previous php.bugs (#95941) next »