Received: from superfly.archi-me-des.de (unknown [62.8.212.177]) by postgresql.org (Postfix) with ESMTP id 74AE24767D9 for ; Sat, 16 Mar 2002 18:24:33 -0500 (EST) Received: (from frank@localhost) by superfly.archi-me-des.de (8.9.3/8.9.3) id AAA14524; Sun, 17 Mar 2002 00:24:34 +0100 Date: Sun, 17 Mar 2002 00:24:33 +0100 From: Frank Joerdens To: pgsql-php@postgresql.org Cc: linuxkurs@fas-art.com Subject: pg_errormessage within a transaction block (doesn't work as expected) Message-ID: <20020317002433.A13863@superfly.archi-me-des.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii User-Agent: Mutt/1.1.2i X-Subliminal-Message: Use Linux! Use Linux! X-Archive-Number: 200203/34 X-Sequence-Number: 1003 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