pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Eaglet <Aquil8@infinito.it>
To: pgsql-hackers@postgresql.org.pgsql-admin
Subject: handling exceptions, really not simple... :-((
Date: Wed, 14 Nov 2001 12:51:30 +0100
Message-ID: <9stld9$1cloc$1@news02.it.net> (raw)

Hi 2 everybody!

I'm evaluating a database that supports our 3-tier solutions, in addition to
Oracle.
Postgres is at the moment the candidate n. 1, but I realized it's very hard
to translate this type of code (Orqcle PL/SQL):

FUNCTION F_EXT(par1, par2 ...) RETURN.... IS
BEGIN
    SAVEPOINT spF_EXT;
    ...[instructions]
    INSERT INTO...
    UPDATE...
    DELETE...
    ...[instructions]

    SAVEPOINT spF_INT;
    ret := F_INT(par1, par2 ...);

    IF ret = 'KO' THEN
        ROLLBACK TO spF_EXT;
    ELSE IF ret IS NULL THEN
        ROLLBACK TO spF_INT;
    END IF;

    ...[instructions]
    COMMIT;
EXCEPTION
    WHEN.....
          ...[instructions]
END F_EXT;

The goal to achieve is to trap every kind of execution errors without trying
to prevent their occurrence.
In any case, I usually can't be sure the function (F_EXT) works correcty: an
exception could be lanched by an internal function (F_INT), I couldn't know
to estabilish what happens and where ...
By the way, the evironment is:
the browser requests a PHP page that connect to a Data Source (Oracle) and
lanch a Stored Procedure; after the execution by Oracle, PHP get the result
and returns data or a message to the client.
It's very important for me to solve the application logic in the Back-End of
the system (Oracle or Postgres): integrity and meaning of function aren't
only "commit all" or "rollback all", and when something of wrong happens, I
need to know the type of exception and when it occurred. In Oracle I can do
this, but in Postgres I've not yet found anything of similar.
Can anyone help me?
Thanks in advance...

Eaglet





view thread (2+ messages)  latest in thread

Message-ID: <9stld9$1cloc$1@news02.it.net>
Permalink:  ../9stld9$1cloc$1@news02.it.net/
Also on:    postgresql.org/message-id/9stld9$1cloc$1@news02.it.net

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: Aquil8@infinito.it, pgsql-hackers@postgresql.org.pgsql-admin
  Subject: Re: handling exceptions, really not simple... :-((
  In-Reply-To: <9stld9$1cloc$1@news02.it.net>

* 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