pg_errormessage within a transaction block (doesn't work as expected)

From: Frank Joerdens <frank(at)joerdens(dot)de>
To: pgsql-php(at)postgresql(dot)org
Cc: linuxkurs(at)fas-art(dot)com
Subject: pg_errormessage within a transaction block (doesn't work as expected)
Date: 2002-03-16 23:24:33
Message-ID: 20020317002433.A13863@superfly.archi-me-des.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Browse pgsql-php by date

  From Date Subject
Next Message ameen eetemadi 2002-03-17 13:32:26 postgres array type
Previous Message timothy_maguire 2002-03-15 17:40:34 Re: case insensitive search