Hi folks, Using the Postgres extension for the first time, and am somewhat taken aback by the approach to error handling.
First: error numbers With the MySQL api, you can get an error number. With the Postgres extension, it seems you can only get a message string. So to test for a particular error, you have to run a regex and hope the developers don't change the error message. Is this the situation, or am I missing something? Second: pg_result_error( $result_resource ) The manual recommends this over pg_last_error( ) but I'm baffled by how to use it. pg_query() returns FALSE on failure, not a result resource. So when there's an error there is no resource for pg_result_error( ) to use. What's going on here?? Finally: system error handling On failure, pg_query() throws a PHP SYSTEM_WARNING. This seems odd: why should PHP react to something happening internally inside Postgres? The MySQL extension behaves as you would expect, and throws no PHP error at all. On most systems, ours included, this is going to screw up the error handling. So you have to wrap every Postgres query with: $level = error_reporting( 0 ); // Errors off pg_query( ... ) ; error_reporting( $level ); // Back to default errors Not a major issue for us as we have an abstraction api and only have to do this in one place, but still an unnecessary resource hit. There doesn't seem to be a configuration option to change this odd behaviour. Again, is this really the situation or am I missing something? -- Geoff Caplan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php