#31238 [Ana->Bgs]: pg_field_is_null fails for column with upper case name
| From: | vrana@php.net | Date: | Wed, 29 Dec 2004 13:41:50 +0000 |
| Subject: | #31238 [Ana->Bgs]: pg_field_is_null fails for column with upper case name | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969365655@lists.php.net to get a copy of this message | ||
ID: 31238
Updated by: vrana@php.net
Reported By: phpdevel-no-spam at pv2c dot sk
-Status: Analyzed
+Status: Bogus
Bug Type: Documentation problem
Operating System: *
PHP Version: 4CVS, 5CVS (2004-12-22)
Assigned To: sniper
New Comment:
It's already mentioned at http://www.php.net/manual/en/ref.pgsql.php :
"PostgreSQL automatically folds all identifiers (e.g. table/column
names) to lower-case values. To get it to recognize upper-case values,
you must always wrap the identifier in quotes."
Previous Comments:
------------------------------------------------------------------------
[2004-12-22 18:32:10] iliaa@php.net
This should be documented.
------------------------------------------------------------------------
[2004-12-22 09:06:10] sniper@php.net
I can verify this. It happens because the underlying
PQfnumber() function tolower()'s the passed field name.
You can avoid that by passing the name double-quoted:
- if(pg_field_is_null($res, 0, $field))
+ if(pg_field_is_null($res, 0, "\"$field\""))
I have prepared a patch for this but it's up to the "committee" whether
we will fix this in sources or in documentation.
------------------------------------------------------------------------
[2004-12-22 01:00:11] phpdevel-no-spam at pv2c dot sk
Description:
------------
When calling pg_field_is_null() with 3. parameter the column name and
it has upper case letters in it, an error is the result:
"PHP Warning: pg_field_is_null(): Bad column offset specified in
bugtest.php on line 15"
This bug was reproduced using PostgreSQL 7.4.6, PHP 4.3.10
PostgreSQL 7.4.6, PHP 4.3.9
PostgreSQL 7.4.6, PHP 4.3.10
using two different servers.
This bug doesn't occur when the 3. parameter is column offset, or the
column name contains only lover case letters.
Reproduce code:
---------------
http://www.pv2c.sk/php/bugtest.zip (1KB)
Included is also a sample db creation script.
Expected result:
----------------
Just want to know if the column is NULL.
Actual result:
--------------
Just an warning.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=31238&edit=1