#33809 [NEW]: pg_fetch_result: table alias produces invalid column result error

From: Date: Thu, 21 Jul 2005 17:22:11 +0000
Subject: #33809 [NEW]: pg_fetch_result: table alias produces invalid column result error
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-82289@lists.php.net to get a copy of this message
From: torpedo51 at yahoo dot com Operating system: Linux 2.6.11 PHP version: 5.0.3 PHP Bug Type: PostgreSQL related Bug description: pg_fetch_result: table alias produces invalid column result error Description: ------------ Using table aliases when retrieving a column value (for the purpose of resolving column name ambiguity) is producing an "invalid column name" error. This produces the error: $sql = "select t1.c1, t2.c1 from..." $intValue1 = pg_fetch_result($rs, $intRow, 't1.c1'); $intValue2 = pg_fetch_result($rs, $intRow, 't2.c1'); This is ambiguous but does not produce an error: $sql = "select t1.c1, t2.c1 from..." $intValue1 = pg_fetch_result($rs, $intRow, 'A'); $intValue2 = pg_fetch_result($rs, $intRow, 'B'); This is valid: $sql = "select t1.c1 as A, t2.c1 as B from..." $intValue1 = pg_fetch_result($rs, $intRow, 'A'); $intValue2 = pg_fetch_result($rs, $intRow, 'B'); PostGres: 8.0.3 php.ini diff: ShortTags = Off Reproduce code: --------------- $sql = "select t1.c1, t2.c1 from table1 t1, table2 t2"; $rs = pg_query($sql); $intValue = pg_fetch_result($rs, $intRow, 't1.c1'); Expected result: ---------------- I expect to be able to retrieve the columns using the explicit name that includes the table alias. Previous versions did not produce this error. I also ran this same test using mySql (mysql_fetch) which does not produce the error. I also tested this which does not produce the error: $row = pg_fetch_assoc($rs); $intValue1 = $row['t1.c1'] $intValue2 = $row['t2.c1'] Actual result: -------------- [client 127.0.0.2] PHP Warning: pg_fetch_result() [function.pg-fetch-result]: Bad column offset specified in /home/spr/Documents/web/spr/spr4/web/10dev/modules/datasvcs.php on line 210 -- Edit bug report at http://bugs.php.net/?id=33809&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33809&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33809&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33809&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=33809&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=33809&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=33809&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=33809&r=needscript Try newer version: http://bugs.php.net/fix.php?id=33809&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=33809&r=support Expected behavior: http://bugs.php.net/fix.php?id=33809&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=33809&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=33809&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=33809&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33809&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=33809&r=dst IIS Stability: http://bugs.php.net/fix.php?id=33809&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=33809&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=33809&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=33809&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=33809&r=mysqlcfg

« previous php.bugs (#82289) next »