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

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 ... ]


---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Reply via email to