Re: PL/PgSQL STRICT - Mailing list pgsql-hackers

From Marko Tiikkaja
Subject Re: PL/PgSQL STRICT
Date
Msg-id 50D48E84.3050203@joh.to
Whole thread Raw
In response to Re: PL/PgSQL STRICT  (Christopher Browne <cbbrowne@gmail.com>)
List 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 by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: PL/PgSQL STRICT
Next
From: Marko Tiikkaja
Date:
Subject: Re: PL/PgSQL STRICT