I made up a php test script for this: ext/pgsql/tests/80_bug32223.phpt
But i cannot reproduce your behavior with 5.1-dev or HEAD.
Maybe it is postgres?
marcus=# select version();
version
--------------------------------------------------------------------------------------------------------------------------------------
PostgreSQL 8.0.1 on i586-mandrake-linux-gnu, compiled by GCC i586-mandrake-linux-gnu-gcc (GCC) 3.4.3 (Mandrakelinux 10.2 3.4.3-7mdk)
Works in all versions for me. So please try the following:
php run-tests.php ext/pgsql/tests/80_bug32223.phpt
If that fails, can you do a 'memcheck' on that?
And tell me your postgres version.

This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Fixed in 4.4.2-dev, 5.1.0RC4-dev, HEAD