php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29709 pg_fieldname returns an unqualified name
Submitted: 2004-08-16 19:01 UTC Modified: 2004-08-17 00:16 UTC
From: hayk at mail dot ru Assigned:
Status: Not a bug Package: PostgreSQL related
PHP Version: 4.3.8 OS: FreeBSD 4.8
Private report: No CVE-ID: None
 [2004-08-16 19:01 UTC] 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?

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-08-17 00:16 UTC] iliaa@php.net
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. 
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 05 10:01:32 2024 UTC