Re: PL/PgSQL STRICT

Поиск
Список
Период
Сортировка
От Marko Tiikkaja
Тема Re: PL/PgSQL STRICT
Дата
Msg-id 50D48E84.3050203@joh.to
обсуждение исходный текст
Ответ на Re: PL/PgSQL STRICT  (Christopher Browne <cbbrowne@gmail.com>)
Список pgsql-hackers
On 12/21/12 5:09 PM, Christopher Browne wrote:
> I could use GET DIAGNOSTICS to determine if nothing got altered, and
> it seems likely to me that expressly doing this via IF/ELSE/END IF would
> be easier to read in function code than a somewhat magic STRICT
> side-effect.

STRICT is used in INTO, so PL/PgSQL users should already have an idea 
what it's going to do outside of INTO.

> I certainly appreciate that brevity can make things more readable, it's
> just
> that I'm not sure that is much of a help here.
>
> This is adding specific syntax for what seems like an unusual case to me,
> which seems like an unworthwhile complication.

A quick grep suggests that our (the company I work for) code base has 
160 occurrences of INSERT/UPDATE/DELETE followed by IF NOT FOUND THEN 
RAISE EXCEPTION.  So it doesn't seem like an unusual case to me.

Of course, some of them couldn't use STRICT because they are expected to 
happen (in which case they can send a more descriptive error message), 
but most of them could.


Regards,
Marko Tiikkaja



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

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: PL/PgSQL STRICT
Следующее
От: Marko Tiikkaja
Дата:
Сообщение: Re: PL/PgSQL STRICT