pg_errormessage within a transaction block (doesn't work as expected) - Mailing list pgsql-php

From Frank Joerdens
Subject pg_errormessage within a transaction block (doesn't work as expected)
Date
Msg-id 20020317002433.A13863@superfly.archi-me-des.de
Whole thread Raw
List pgsql-php
When I call pg_errormessage() *after* a transaction block, it doesn't
catch any errors which have occurred within, apparently. If I call
pg_errormessage() right after the query which throws the error inside
the transaction, it catches the error. This is the correct behaviour, or
it isn't, according to the definition, depending on how you look at it:

------------------- begin definition -------------------
pg_errormessage() returns a string containing the last error message for
given connection. It returns FALSE on failure.
------------------- end definition -------------------

If we take this to mean that pg_errormessage() is overwritten by the
last statement in the transaction (that's the impression I get), i.e.

pg_exec($conn, "COMMIT WORK;");

which never fails (if the transaction rolls back, it's not handled as an
error), then this would mean that in this scenario, pg_errormessage() is
pretty useless. I'd want a function that actually returns the last
error, wherever it may have occurred within my script. Any opinions,
experiences, ideas?

Regards, Frank

pgsql-php by date:

Previous
From: knut.suebert@web.de
Date:
Subject: Re: case insensitive search
Next
From: ameen eetemadi
Date:
Subject: postgres array type