Re: User's exception plpgsql - Mailing list pgsql-patches

From Pavel Stehule
Subject Re: User's exception plpgsql
Date
Msg-id Pine.LNX.4.44.0507061855560.23774-100000@kix.fsv.cvut.cz
Whole thread Raw
In response to Re: User's exception plpgsql  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: User's exception plpgsql  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-patches
> and maybe the short-term cheesy thing to do is special-case exactly this
> syntax:
>
>     RAISE LEVEL [ SQLSTATE(text_expr), ] text_expr [, ... ]
>
> which would give us the minimum functionality with a clear path to
> expansion later.
>
or only RAISE LEVEL SQLSTATE(text_expr)|text_expr [, ...]

if I use registered sqlstate, plpgsql knows text message. But I think this
syntax has more questions than exception's variables. It's really problem
declare one exceptio's variable? It's similar like using constant
variables or magic values.

Pavel

DECLARE not_money EXCEPTION=SQLSTATE('U1101');
BEGIN
  IF account < 0 THEN
    RAISE EXCEPTION not_money;
  ...

or

BEGIN
  IF account < 0 THEN
    RAISE SQLSTATE ('U1101') 'Not money';



pgsql-patches by date:

Previous
From: Tom Lane
Date:
Subject: Re: User's exception plpgsql
Next
From: Tom Lane
Date:
Subject: Re: User's exception plpgsql