From: Neil Conway <neilc@samurai.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Pavel Stehule <stehule@kix.fsv.cvut.cz>
Cc: pgsql-patches@postgresql.org
Subject: Re: User's exception plpgsql
Date: Thu, 07 Jul 2005 02:10:08 +1000
Message-ID: <42CC0260.4090407@samurai.com> (raw)
In-Reply-To: <26946.1120665361@sss.pgh.pa.us>
References: <Pine.LNX.4.44.0506260904040.21791-200000@kix.fsv.cvut.cz>
<42CBF6AD.9080600@samurai.com>
<26946.1120665361@sss.pgh.pa.us>
Tom Lane wrote:
> I think it is a bad idea, if not actually impossible, to have an
> expression for sqlstate with no separating syntax before the 'fmt';
> especially not if you'd like to also allow an expression for the 'fmt'.
I don't actually see much of a need to allow 'fmt' to be an expression,
especially now that RAISE parameters can be expressions. The ratio of
constant printf() format strings to variable format strings is probably
100:1, for good reason...
> The hard part here is that there isn't any very easy way to tell whether
> you have a sqlstate, a fmt, and N exprs, or a fmt and N+1 exprs. The
> saving grace of the declared-exception approach for this is that you
> can tell by the datatype of the first argument expression which case you
> have
I really don't like the idea of introducing a new concept into the
language ("exception variables") to resolve some ambiguous syntax. It
would be another matter if exception variables actually provided
something that strings do not...
Another solution might be varying the syntax slightly, such as:
RAISE [ opt_sqlstate ] LEVEL 'fmt' [ , expr ... ]
-Neil
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-hackers@postgresql.org
Cc: neilc@samurai.com, tgl@sss.pgh.pa.us, stehule@kix.fsv.cvut.cz, pgsql-patches@postgresql.org
Subject: Re: User's exception plpgsql
In-Reply-To: <42CC0260.4090407@samurai.com>
* 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