Re: User's exception plpgsql

From: Neil Conway <neilc(at)samurai(dot)com>
To: Pavel Stehule <stehule(at)kix(dot)fsv(dot)cvut(dot)cz>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: User's exception plpgsql
Date: 2005-07-06 15:20:13
Message-ID: 42CBF6AD.9080600@samurai.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Pavel Stehule wrote:
> Per small recent discussion I corrected patch user's exception.

Attached is a revised patch. I haven't looked at the documentation
changes yet (more work is needed I believe) or some of the error message
text.

I was originally hoping to make "exception variables" a little more
full-featured -- it seems silly to DECLARE something that cannot be
initialized with the value of another expression, for example. I can
also see how it would be useful to evaluate an expression variable (e.g.
to print it out for debugging purposes). It would be possible extend the
operations allowed upon exception variables, thinking about this
further, I wonder if there is any point introducing the concept of an
"exception variable" in the first place. What does it buy us over simply
using a string? In other words, if we allowed the syntax:

RAISE LEVEL [ opt_sqlstate ] 'fmt' [, expr ... ]

where `opt_sqlstate' is either empty, a T_WORD we find in the table of
predefined condition names, or an expression that evaluates to a text
value. The text value must be of a certain form (e.g. 5 characters in
length, begins with a "U" and so on).

It might be slightly more difficult to parse this (especially if we
allow 'fmt' to be an expression yielding a string, not just a string
literal), but I don't think it is ambiguous and can be sorted out via
yylex().

-Neil

Attachment Content-Type Size
usrexcpt-11.diff text/plain 23.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2005-07-06 15:26:52 Re: timezone changes break windows and cygwin
Previous Message Bruce Momjian 2005-07-06 15:15:51 Re: timezone changes break windows and cygwin

Browse pgsql-patches by date

  From Date Subject
Next Message Neil Conway 2005-07-06 15:45:53 ecpg: fix ECPGstore_input()
Previous Message Bruce Momjian 2005-07-06 14:45:13 Re: Disable page writes when fsync off, add GUC