PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Database » DB » Bug #2399

DB_pgsql->errorCode() regexp test fails

Details

Submitted2004-09-25 21:29 UTC
Fromcrain at fuse dot net
Assigneddanielc
StatusClosed
PackageDB
PHP Version4.3.4
OSWinXP
Roadmaps(Not assigned)

Comments

[2004-09-25 21:29 UTC] crain at fuse dot net

Description:
------------
errorCode() fails to detect a pgsql "relation...does not exist" error returned when nextId() attempts to increment a sequence and, failing, attempts to create a new one. This appears to be because of the regexp entry for this error type in DB_pgsql->errorCode(), line 246. There is a caret (^) symbol anchoring the beginning of this regexp:

'/^(([Rr]elation|[Ss]equence|[Tt]able)( [\"\'].*[\"\'])? does not exist|[Cc]lass ".+" not found)$/' => DB_ERROR_NOSUCHTABLE

As a result, the regexp will not match an error string such as:

'ERROR: relation "src_main_seq" does not exist'

And errorCode() therefore returns the default DB_ERROR, while nextId() is expecting DB_ERROR_NOSUCHTABLE. nextId() as a result will not create a new sequence when one is not found.

Previous versions do not have this caret symbol and so the bug is new.