PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Database » DB » Bug #446

errorCode($errormsg) is not working correctly for postgresql 7.4 (PATCH)

Details

Submitted2003-12-17 19:12 UTC
Fromeike at unorganized dot net
Assignedlsmith
StatusClosed
PackageDB
PHP Version4.3.3
OSIrrelevant
Roadmaps(Not assigned)

Comments

[2003-12-17 19:12 UTC] eike at unorganized dot net

Description:
------------
One of my php scripts uses nextId(), and after changeing from a mysql db to a postgresql 7.4 db, those nextId() calls stopped working, always returning '1'.

While looking into this, I found the error in function errorCode($errormsg): the "relation 'foobar' does not exist" error was not mapped to DB_ERROR_NOSUCHTABLE.

postgresql 7.4 seems to have changed the error message when querying a nonexisting sequence:

- Relation 'foobar' does not exist
+ relation 'foobar' does not exist

The easiest fix is to make the checks in errorCode() case-insensitive: <a href="http://bastard.pmnet.uni-oldenburg.de/pgsql.php.errorCode.caseinsensitive.txt">http://bastard.pmnet.uni-oldenburg.de/pgsql.php.errorCode.caseinsensitive.txt</a>

After applying that, my nextId() calls work again.

Thanks,
Eike