#29709 [Opn->Bgs]: pg_fieldname returns an unqualified name
ID: 29709
Updated by: iliaa@php.net
Reported By: hayk at mail dot ru
-Status: Open
+Status: Bogus
Bug Type: PostgreSQL related
Operating System: FreeBSD 4.8
PHP Version: 4.3.8
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Looks at what the same query produces when ran manually via
psql. You are not selecting those columns, but 2 strings.
Previous Comments:
------------------------------------------------------------------------
[2004-08-16 19:01:49] hayk at mail dot ru
Description:
------------
For "SELECT field1, field2 FROM table"
pg_field_name() returns "field1" and "field2", but for "SELECT
'field1', 'field2' FROM table" (when fields name in single quotes)
returns "?column?" and "?column?".
PostgreSQL(libpq) Version 7.4.2
Reproduce code:
---------------
$pc = pg_connect("dbname=webmail");
$res = pg_query($pc, "SELECT 'userid', 'domainid' FROM users WHERE
userid=1");
$num = pg_num_fields($res);
for ($i=0; $i<$num; $i++)
{
$fieldname = pg_field_name($res, $i);
echo "column $i: $fieldname <br>";
}
Expected result:
----------------
column 0: userid
column 1: domainid
Actual result:
--------------
column 0: ?column?
column 1: ?column?
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=29709&edit=1
Thread (2 messages)