Edit report at http://bugs.php.net/bug.php?id=52388&edit=1

 ID:               52388
 User updated by:  michael at jmslondon dot com
 Reported by:      michael at jmslondon dot com
 Summary:          pg_fetch return space char on empty field
-Status:           Open
+Status:           Closed
 Type:             Bug
 Package:          PostgreSQL related
 Operating System: Linux
 PHP Version:      5.2.13

 New Comment:

The submission has altered this so it is unreadable. Closing it as make
no sense


Previous Comments:
------------------------------------------------------------------------
[2010-07-21 13:41:39] michael at jmslondon dot com

Description:
------------
pg_fetch_* returns space string (e.g. ' ') when
returning a empty sting

''
Postgres is returning an
empty string and pg_fetch is 
changing the return
value.
Empty string is only return if the result is

caste as a varchar in the sql

e.g."SELECT test_thing::varchar".

Test script:
---------------
//In DB
CREATE TABLE test ( test_thing VARCHAR(5) NOT
NULL DEFAULT '');
INSERT INTO test
VALUES
('');

//code
$testing
= pg_query($db_conn,"SELECT test_thing FROM test WHERE
test_thing='');
print_r(pg_fetch_all($testing));
print
'testing'.pg_fetch_result($testing,0,0).'this';

Expected result:
----------------
array(1) {
[0]=
  array(1)
{
   

['test_thing']=
    string(0)

''
}
}

testingthis



Actual result:
--------------
array(1) {
[0]=
  array(1)
{
   

['test_thing']=
    string(1)
'

'
}
}

testing
this


------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=52388&edit=1

Reply via email to