pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Frank Joerdens <frank@joerdens.de>
To: pgsql-php@postgresql.org
Cc: linuxkurs@fas-art.com
Subject: pg_errormessage within a transaction block (doesn't work as expected)
Date: Sun, 17 Mar 2002 00:24:33 +0100
Message-ID: <20020317002433.A13863@superfly.archi-me-des.de> (raw)

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



Message-ID: <20020317002433.A13863@superfly.archi-me-des.de>
Permalink:  ../20020317002433.A13863@superfly.archi-me-des.de/
Also on:    postgresql.org/message-id/20020317002433.A13863@superfly.archi-me-des.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-php@postgresql.org
  Cc: frank@joerdens.de, linuxkurs@fas-art.com
  Subject: Re: pg_errormessage within a transaction block (doesn't work as expected)
  In-Reply-To: <20020317002433.A13863@superfly.archi-me-des.de>
  References: <20020317002433.A13863@superfly.archi-me-des.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox