Re: proposal: plpgsql - Assert statement

From: Jan Wieck <jan(at)wi3ck(dot)info>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: Craig Ringer <craig(at)2ndquadrant(dot)com>, Marko Tiikkaja <marko(at)joh(dot)to>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: proposal: plpgsql - Assert statement
Date: 2014-09-18 00:40:51
Message-ID: 541A2A13.20100@wi3ck.info
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 09/17/2014 03:36 PM, Peter Eisentraut wrote:
> On 9/17/14 3:04 PM, Pavel Stehule wrote:
>> What is difference between content of variable or content of database?
>> You can test any prerequisite, but when this prerequisite is not solved,
>> than exception is very very hard without possible handling.
>
> If the assertion tests arbitrary Boolean expressions, then we can't stop
> the user from abusing them.

Exactly. Doing something like

ASSERT (select count(*) from foo
where fk not in (select pk from bar)) = 0;

is a perfectly fine, arbitrary boolean expression. It will probably work
well in a development environment too. And I am very sure that it will
not scale well once that code gets deployed. And I know how DBAs react
to the guaranteed following performance problem. They will disable ALL
assert ... or was there some sort of assert class system proposed that I
missed?

>
> But it's another thing if we design specific syntax that encourages such
> abuse, as proposed earlier.

The design should explicitly discourage that sort of nonsense.

Jan

--
Jan Wieck
Senior Software Engineer
http://slony.info

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Craig Ringer 2014-09-18 03:37:21 Re: [Windows,PATCH] Use faster, higher precision timer API
Previous Message Peter Geoghegan 2014-09-18 00:26:05 Re: Collations and Replication; Next Steps