Re: PL/PgSQL STRICT

From: Marko Tiikkaja <pgmail(at)joh(dot)to>
To: Christopher Browne <cbbrowne(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PL/PgSQL STRICT
Date: 2012-12-21 16:29:56
Message-ID: 50D48E84.3050203@joh.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Marko Tiikkaja 2012-12-21 16:32:23 Re: PL/PgSQL STRICT
Previous Message Pavel Stehule 2012-12-21 16:28:49 Re: PL/PgSQL STRICT