Re: User's exception plpgsql

Поиск
Список
Период
Сортировка
От Neil Conway
Тема Re: User's exception plpgsql
Дата
Msg-id 42CC0260.4090407@samurai.com
обсуждение исходный текст
Ответ на Re: User's exception plpgsql  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: User's exception plpgsql
Re: User's exception plpgsql
Список pgsql-patches
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

В списке pgsql-patches по дате отправления:

Предыдущее
От: Mark Deric
Дата:
Сообщение: Bad link Makefile patch
Следующее
От: Pavel Stehule
Дата:
Сообщение: Re: User's exception plpgsql