Re: custom error messages/numbers

From: Richard Huxton <dev(at)archonet(dot)com>
To: BARTKO Zoltan <bartko(dot)zoltan(at)pobox(dot)sk>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: custom error messages/numbers
Date: 2004-05-27 17:18:36
Message-ID: 40B622EC.1040204@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

BARTKO Zoltan wrote:
> Folks,
>
> I am developing an app for PostgreSQL, entirely with stored functions
> (somewhat resembling the object-oriented approach. In fact it is not
> an app, just an API). All my functions return an integer value - 0 if
> the function was successful, another value otherwise.
>
> Until now, all parameter checking was done manually in the stored
> function (if param is null then return -8; end if; etc.) This makes
> things quite lengthy.
>
> I know about check constraints. However, upon error they throw an
> error message and abort the current transaction, So my question is:
> is there any possible way of throwing my own error messages upon a
> check constraint violation?

Not in v7.4 - there should be nested transactions available in 7.5 which
might allow this. In fact, I think the developer of nested transactions
is looking for testers at the moment - see the hackers list for details.

In actual fact, I'd be tempted to move the procedural API out of the
database. If all your access is to be through the API and not using SQL
there seems little point in embedding it inside PG.

--
Richard Huxton
Archonet Ltd

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2004-05-27 17:58:45 Re: Database Size Limiting
Previous Message Campano, Troy 2004-05-27 17:07:45 Database Size Limiting