Hi,
There is a nasty problem with using the new sqlstate codes in the
PostgreSQL extension.
Say you want to find the sqlstate error code of a query that fails, the
function prototype is:
$sqlstate = pg_result_error_field($result, PGSQL_DIAG_SQLSTATE);
HOWEVER, it is not possible to get a result resource from a failed
pg_query! pg_query() returns FALSE on failure, not a result.
The only way to get the result is to use the asynchronous interface,
which basically no-one does.
What should we do?
I can perhaps store a per-connection sqlstate after each query, but what
about all the other error fields:
PGSQL_DIAG_SEVERITY, PGSQL_DIAG_MESSAGE_PRIMARY,
PGSQL_DIAG_MESSAGE_DETAIL, PGSQL_DIAG_MESSAGE_HINT,
PGSQL_DIAG_STATEMENT_POSITION, PGSQL_DIAG_INTERNAL_POSITION (PostgreSQL
8.0+ only), PGSQL_DIAG_INTERNAL_QUERY (PostgreSQL 8.0+ only),
PGSQL_DIAG_CONTEXT, PGSQL_DIAG_SOURCE_FILE, PGSQL_DIAG_SOURCE_LINE or
PGSQL_DIAG_SOURCE_FUNCTION
???
Chris